This might seem a bit cheesy, but I actually talked to my best friend, and I would type up the text or email I wanted to send, and send it to him first. ALWAYS. And I had to wait until he responded before I could send it to XW. And about 99 out of 100 never got sent to her, and pretty soon, I started to learn when it needed to be said, and when it was just my thoughts churning.
Also, I would say if I could sum up this battle: taking captive of every single thought. And I know that sounds massively overwhelming in a swirling head, but I would practice picking out a thought like "I wonder if XW is with OM?" and making myself stop and focus on that ONE thought. And say, "Ok, so what if she is? What can I do? How does thinking about it and worrying about it move me forward?"
Of course, I already knew the answer, but that practice of forcing myself to stop the swirling and focus on something allowed me to then discard it. And then I would capture the next thought, and do the same. And eventually, the ping-pong tournament in my head slowed down.