If working out doesn't work, I end up taking a couple of days for myself to build or study whatever it is that had been on my mind.
I have been doing downhill/freeride mountainbiking and enjoy bouldering right now. Both sports don't allow your mind to wander off - you need to be 100% focused on your body. In case of mountainbiking, a lot of adrenaline was involved because of the risk. I felt that when the mind realizes there are serious consequences from not focusing completely on the task at hand (e.g. when you are racing through trees), it will focus automatically. This hasn't happened to me when going jogging or so - my mind would still be able to wander off.
YMMV, as always. Good luck!
Also try 1g Niacin, 1g Vitamin C, and 500mg Pantothenic Acid before bed.
Taper off the pharmaceutical drugs if you can.
(I'm curious if this will work for you, so if you try it out, then it would be nice if you post a reply telling me what your results were.)
I don't want to sound snarky, but I think I ought to mention that this actually works.
Thinking is important but learning when to get outside your head and be present is much more important.
Read Eckhart Tolle
Personally, I have a series of large Rubiks-style cubes, up to 7x7x7. Scrambling and solving these has become a kind of mental exercise for me that gets me off of the train of thought that I'm on, and it's useful for disrupting constant repetition.
Another thing is rubber ducking ( http://en.wikipedia.org/wiki/Rubber_duck_debugging ) which works really well for taking large rambling thoughts and condensing them into small, simple, focused ideas. Don't ramble at the duck. Try to explain to the duck in a way that you feel resembles real communication, instead of ranting.
And yes, exercise.
My #1 go-to recommendation is the AUDIO book (not the written version) of When Things Fall Apart by Pema Chodron. Don't worry if you're not going through what sounds like a crisis… the audiobook is accessible for even minor issues, like "being a human."
http://www.amazon.com/When-Things-Fall-Apart-Difficult/dp/15...