How do you know when it's time to end your Relationship?

My Boyfriend has been talking to this girl he says he's been best friends with for five years and they've dated before but it never worked out for them. But, he is always flirting with her. I don't know what I should do? I've asked him to stop talking to her and he does until I stop checking his phone. But once he notices I haven't checked it he goes right back to messaging her. And I always end up finding it. He has even tried putting her under a guys name. 😔😔