In my opinion, having friends that you consider homophobic when you yourself are gay is very toxic and damaging to your self esteem. I know it's tough, but you have to consider how close you really feel to him, and if having him as a friend is worth it. In my life, one of the best things I did for myself was filtering homophobic people out of my life. You have to either come out to him, or let him know that you don't want to hear homophobic language and sentiments. It will become clear whether you should remain friends with him or not after that.
I'd say you have a couple options next time he says something homophobic and you're in a situation to actually talk (meaning no other people around to make you both feel uncomfortable): A) Say or imply that you don't have a problem with gays or being gay, and see what his response is. B) Ask him WHY he feels that way about homosexuality, and see what his response is. C) You could always just come out to him, but that may be too much at once for the both of you. I'd save this for after you have probed him a little more.
Wouldn't a real friend accept you for who you are, regardless of his prejudices? For all you know, he could be struggling with it himself, as others have suggested. While that's not guaranteed, if he IS struggling with it, you could be doing him a favor by discussing the issue openly with him. If he's simply never been exposed to gay people in his life, you're still doing him and yourself a favor by discussing it–if he really likes you as a person, he'll try to understand you rather than shunning you. If you don't feel safe talking to him at all about it, I'd just try to find other friends--ones that you know won't have a problem with you being gay.
Again, I know it's tough, but think of it as you giving yourself permission to be accepted. You should not have to put up with someone talking negatively about you, directly or indirectly. You deserve to surround yourself with people who know all of you and accept all of you. In order to avoid rejection, you must first accept yourself, and put up with no less from others.