Meditate.
Sit with back straight, breath deeply... focus on breathing, and NOT on thoughts. Don't try to "destroy" or end any thoughts, as that is like "trying to NOT think about an elephant". Rather just try to stop any chains of verbal thoughts you are thinking on purpose, and any that DO pop up in your mind, treat them like clouds... gently and easily let them pass and stop being thought... gently and calmly try to blank your mind... imagine a blank screen or an empty sky.. let ALL thought processes evaporate like fog, and just sit, breath, and be mellow and blank. It all the incessant habitual verbal thought loops that are the problem, you just have to know how to control your own mind and stop your thoughts.
Another trick you can try if "being blank" does not help, which really accomplishes the same thing but involves a little bit of active but rather abstract "thinking" and visualization, that can be easier that trying "stop all thoughts" as described above...
I call it the "Step Up A Level" visualization. Try to "step back" a level from all thoughts, feelings, hallucinations you are having... DONT be the person having the bad thoughts... step UP a level and try to BE the inner "All Seeing Eye" that is watching "You" having the "bad thoughts." Dont be "The Inner Watcher"... instead try to "Be The One Who Is Watching The Watcher." Understand?
In other words, our mind and senses project their impressions and thought-loops onto a movie screen inside your head... "You" are a little model of yourself sitting inside a little virtual room inside your head watching this screen. So to get out of a bad trip, try to think about
"Me wathching the inner movie of my senses and thoughts on the screen of my mind", and then ask your self, "Well then WHO is having THIS thought? THAT is the
real me".
In other words, there is ALWAYS a projection and a viewer. Even the "viewer watching the inner projection" is itself a projection.
TRY TO OBSERVE YOURSELF WATCHING AND EXPERIENCING THE BAD TRIP JUNK. BE the "higher level viewer" who is "watching the watcher." This sets you up/back a level and disconnects "you" from the unpleasant stuff... it DIS-identifies the negative ideas and feeling from your "Real Me", and lets you disconnect from them and see them as some malfunctioning thought-loop that got stuck running on infinite repeat...
Now you are no longer like the guy at the end of "A Clockwork Orange" strapped into a chair with his eyes propped open being forced to watch the awful movie of all the negative shit. Now "you" are sitting in a separate higher-level movie theater WATCHING the "little you" in a film up there on the screen enduring all this bad stuff. You are no longer stuck IN the movie BEING the person experiencing all sorts of bad stuff being forced upon his mind... you are WATCHING the guy being forced to watch the bad stuff.. and then you can look away or turn it off!
If the "bad stuff" invades THIS higher-level theater of the mind... JUST DO IT AGAIN AND STEP UP *ANOTHER LEVEL*! In other words, there is ALWAYS a higher-level "you" who is just sitting back and dispassionately calmly observing a screen that contains the negative thoughts, not BEING the negative thoughts... Understand?
If this seems to tough to remeber, make an index card on which you have written with a thick back marker in block letters so it is easy to read if your visual field is wavering:
IT'S ALL IN YOUR IMAGINATION.
EVERYTHING IS JUST ANOTHER THOUGHT.
There have been times I started feeling some extremely aggressive "what a stupid piece of shit I am, etc etc" thoughts, that were also manifesting as sort of threatening and monstrous hallucinations, and I and started doing this, and I kept mentally backing up and backing up faster and farther, so that I actually started having this feeling of falling or flying BACKWARDS IN SPACE... retreating from the negative shit... always flying above that self to the higher-level self, then higher still watching THAT self, etc. The "Self" turns into "just another imaginary thought construction", and you can really start feeling a very Cosmic God-like sort of feeling that seems to be the true inner ground, the ultimate basis of all reality.
Bad trips are just you trying to make things unpleasant inside your own skull, so that you are forced to abandon ALL "Selves", which are just illusions, and learn to experience the One Mind that contains it all, and consists of only Light and Love. Understand?
This is a graphic they used to play at peak psychedelic moments of Dead shows.... maybe you can just stare at this for awhile and it will distract your "inner me" from all those negative thought loops, and you will just start feeling really ecstatic and cosmic! (btw, it's spelling out the letters in Sanskrit for the word "Namaste")