Advice please

I really don’t understand my boyfriend. We have been together for 2 years. Live together etc. Throughout the relationship he’s been talking to females (messaging, texts etc). Majority of them are his ex’s..when him and I first got together he made me drop my male friend who was a fwb... we were friends for like 12 years. He keeps bringing up my old friend asking if we ever had sex... I finally told him we did. My friend at the time knew we couldn’t go any further anymore since I got in a relationship. Still to this day he throws the fact i had the guy as a fwb etc... I haven’t spoken to this guy in almost 3 years. My boyfriend always still says I better not be talking to him and If we do we are over etc... but yet hes talking to exs.... I really miss my friend we were more friends than sexual partners....