Whatever we keep pursuing with our thinking & pondering, that becomes the inclination of our awareness.
Therefore, it is very important what kind of thoughts we cultivate and what we abandon for our long-term benefit and happiness.
How to Stop Unwholesome Obsessive Thoughts?
There are several methods (mentioned below). Go to next, only if previous one doesn’t work. When I am overpowered by such thoughts, I try all methods in succession (one after the other).
When evil, unskillful thoughts - imbued with Greed/Hate/Delusion - arise while you are referring to and attending to a particular theme...
Method 1: Change to another theme connected with what is skillful.
Just as a skilled carpenter would use a small peg to knock out, drive out, and pull out a large one.
Method 2: Scrutinize the drawbacks of those thoughts.
Just as a woman - fond of adornment, would be horrified, humiliated, and disgusted if the snake/dog/human carcass were hung from her neck.
Method 3: Pay no mind and pay no attention to those thoughts.
Just as a man with good eyes, not wanting to see forms that had come into range, would close his eyes or look away.
Method 4: Attend to the relaxing of thought-fabrication with regard to those thoughts.
[You can investigate such thoughts (to find the root cause, its conditioning factors, its reason of arising, etc), appease the whole intentional thought process, relaxing the thought-fabrication including relaxing the underlying physical foundation of the thoughts (stress manifesting in physical body) and removal of triggers].
Just as the thought would occur to a man walking quickly, 'Why am I walking quickly? Why don't I walk slowly?' So he walks slowly. Then thought occurs, 'Why am I walking slowly? Why don't I stand?' So he stands. Then thought occurs, 'Why am I standing? Why don't I sit down?' So he sits down. The thought occurs, 'Why am I sitting? Why don't I lie down?' So he lies down. In this way, giving up the grosser posture, he takes up the more refined one.
Method 5: (Last resort) teeth clenched - beat down, constrain, and crush your mind with your awareness.
Just as a strong man, seizing a weaker man by the head or the throat or the shoulders, would beat him down, constrain, and crush him
After the method has worked: i.e. when the unskillful thoughts are gone, steady your mind right within, settle it, unify it, and concentrate it.
This == lead to ==> mastery over the ways of thought sequences. One thinks whatever thought he wants to, and doesn't think whatever thought he doesn't.
Personally, when my mind goes out of control, I try the above steps mentioned in Vitakkasanthana sutta which have proved very beneficial (1st & 2nd step: replacing with opposite skilful thoughts and recalling dangers in unskilful thoughts, has often halted the unskilful process from acceleration. And then I quickly follow 3rd & 4th step: of paying no mind and remove myself from trigger/source). It works wonders: in matter of seconds it changes the whole mind!
It certainly help in removing our obsessions and can therefore help improve Obsessive-Compulsive Disorder (OCD) too. If we can catch those obsessive thoughts and learn to overcome those and relax our mind and body by repeatedly practicing the above ways (starting with smaller obsession to gradually trying the bigger one), the compulsion loses its power over us.
- MN 20: Vitakkasanthana Sutta: The Relaxation of Thoughts http://www.accesstoinsight.org/tipitaka/mn/mn.020.than.html
- Vitakka-Santhana Sutta: The Removal of Distracting Thoughts http://www.accesstoinsight.org/lib/authors/soma/wheel021.html