Need to vent!

So, me and my husband have been ttc for about 2 years now. One miscarriage and a chemical pregnancy last month. Last year he stopped wanted sex but like once a month. No matter how hard I tried to get it started, he just said no. I decided to sit him down and have a heart to heart with him. He told me that he doesn't have a sex drive like he used to. I have a very high sex drive and it was always hard for me to find a partner who could keep up with me until I found him. I told him we will work on it together. A few months pass, I walk into the bathroom and he is masturbating. I got extremely upset. He can't have sex, but he can masturbate? After I calm down, we talk. He tells me he masturbates at least twice a day, he doesn't find me attractive, he finds my best friend attractive which is why he cant have sex with me because he is hoping she will have sex with him. We separate for a couple months. He apologies and says he didn't mean what he said, that he has always found me attractive. He says he can't control the urge to look at porn or masturbate, but he will install a porn blocker on his phone and will no longer masturbate. I suggested he get therapy, he declined going saying he can do it on his own. He kept the blocker for two weeks. He removed it saying he didn't need it anymore because the urge was gone. Then slowly, he started treating me like he did before. Like I'm not even here. It's been a month since we've had sex, he says he isn't masturbating anymore, but all the signs are saying he is. He says he wants a baby, but turns me down when I'm fertile. I have old fashioned views on marriage and really don't want to get a divorce, but I don't know what else to do at this point. He still refuses any kind of counseling, his moods yo yo like they did before, and we're back to having an empty bed. I don't know what to do anymore.