Oh how I can totally relate to this topic!
I have a former dance teacher I'm obsessed with. For four years I've been crying and yearning and screwing up my life over this woman. And it's at the point now where I'm really just kind of bored and fed up with it. But still it happens. Random words or images can trigger intense longing and regret, jealousy and pain.
Being on meds helped (and I'm hoping to find some way to get some meds again)--but what also helped me a couple of years ago when it was really bad was just setting boundaries. Times and situations when I felt it was appropriate and safe to contact or see her, identifying what was appropriate to share with her, and what was not. And just generally trying to put myself first. Having a good therapist at the time was also extremely helpful.
Putting distance between us has also helped. Now that my former teacher is really no longer a part of my day-to-day life, I try to remind myself when these feelings arise that they are in great measure just
symptoms of my mental illness. Not that my former teacher is not a wonderful person, and not that I don't love her, but really right now she's just a phantom of my mind. But I don't want a phantom. I want a real human being who's actually present with me. So I'm working on it
Anyway, YMMV, just thought I'd chime in.