Fight or Leave

An

How do you guys know whether to keep fighting or just leave? My boyfriend & I have been together for 6 years and since the beginning of this year, things have changed. He's not in his best light, and I just don't know what to do anymore. He's distant, he's putting up all these walls, he's becoming insensitive, he's not being himself. I love him and he tells me that he loves me but i just don't know what to do. He never texts me goodnight anymore, we have sex like 3 times a month, he never opens up about his emotions, he's always cranky, he doesn't like it when I'm too affectionate...its like I'm losing him. I have one friend who's telling me to leave him because he's not even trying even after I've talked to him multiple times. And i have another friend who's telling me to stick by him through his best moments and his worst moments. What should i do??