In terms of letting go

In addition to my addiction I have had a boyfriend who never treated me right. And I know it had nothing to do with me but it seems I am also very addicted to him and no matter how he treats me I always wanna go back. And now that we aren’t a couple anymore he still lets me see him but treats me even worse. I am not being physically abused but emotionally. How do I detach myself I am already having a hard time trying to be sober from one addiction and I just want to run to him even though he is so selfish and doesn’t really care about my well being

I have a similar issue with what I would call an addiction to and unhealthy person. He is not my boyfriend but it’s been a long term, unhealthy relationship. I know how difficult it is!
Something I found that helps is ‘turning the mind’.
When I want to contact him I turn the mind, I actually say Turn the Mind out loud, or at least to myself, then immediately find something else to focus on, or refocus on whatever I was doing. Think of anything else, a song, what you want for dinner, grab a snack. Anything. Sometimes it takes turning my mind over and over but it keeps me from contacting him. Sometimes I just do it once and hours pass before I realize how well it worked.