He is in my books, or in my good books. The former is the older form; both mean to be in favour. The word book was at one time used more widely, a single sheet, or even a list being called a book. To be in my books is to be on my list of friends.
“I was so much in his books, that at his decease he left me his lamp.” —Addison.
“If you want to keep in her good books, don't call her `the old lady.' ” —Dickens.
He is in my black (or bad) books. In disfavour. (See Black Books.)
Source: Dictionary of Phrase and Fable, E. Cobham Brewer, 1894