Here's something I hope will help a little. I'm pulling it out from the "Not Just Friends" book.
Obsessive thinking isn't a pathological response to trauma. It is a normal response. Until you grapple with shattered assumptions and construct a story about the affair that makes sense to you, you will be prone to obsessing. In other words, obsessive thoughts may intrude throughout the process of recovery until healing is complete.
The author's suggestions on dealing with this is to write down your thoughts. Keep a journal. Write letters to your partner or the affair partner (that you don't send! Throw them in a fireplace or shred them afterwards).
For thought control she recommends scheduling "worry times." Designate a specific time and over time decrease it. Change the channel by imagining a remove in your head and switching to another channel. Practice thought-stopping. Shut your eyes and subvocally say "stop" to bothersome thoughts and images. Imagine a red stop sign and think the words "stop."
I know a lot of this is easier said than done. I also think it takes a lot of time.
There is no arriving, ever. It is all a continual becoming.