Instead of following the boring traditional ways like keeping yourself busy,blaming yourself, ignoring the problem etc, try seeing through your thoughts. Note down the triggers that causes your overthinking. Don't involve in judgements while doing so. Now it will take a week or two to complete the process.
After this, note down the similarities in the triggers. Are these overthinking patterns life saving or they are just your fantasy and crap. It is important to divide thinking into productive and deceptive. Once you are done., the next time any deceptive messages come to you, simple tell yourself that you are not the one initiating the thought patterns. Rather it is your brain that is doing so. And you are not your brain. Brain is not equal to mind. Mind is what we control, brain is simply a biological organ that will indulge in various thinking patterns as and when it likes. It presents us with various options, some of which are good and some are bad. It is the power of our mind that harnesses brain thoughts into products or problems. You have to know that over thinking will not do some thing in a miracle way.
Plus as suggested by others, try meditation,especially mindfulness training.
But I strongly advise you to read