I need advice

So I have this really good friend and I’ve been friends with him for 4 years and my boyfriend hates him and kinda gives me shit for it especially because he thinks this friend likes me. The reason he thinks that is because he is continuously complimenting my face and my ass and does flirty stuff. Which I agree is weird but I think it’s just nothing and that he doesn’t like me. My boyfriend is starting to get really pissed off and I understand where he is coming from but then again I’ve been friends with this guy for along time so it’s hard to just stop talking to him and I don’t want to do that.

What would u do if you were in this position ??

Thank you