Well, this one helped me out of a bad trip once.
I started getting a serious anxiety attack because I took way too much shrooms, and just kept going higher and higher.
Somehow, this line from a Beatles song popped into my head, and I started repeating it over and over very slowly, kind of humming it, like a mantra.
The line was "Turn off your mind, relax and float downstream, it is not dying, it is not dying", it's from the song Tomorrow Never Knows, off the Revolver album.
I later came to find that these lyrics were inspired by a book called The Psychadelic Experience written by none other than Timothy Leary, Richard Alpert and Ralph Metzner, and they based their book on the Tibetan Book of the Dead.
That was my one and only bad trip, and ever since that mantra came to me, I've never had anxiety about a trip, I know I have it to help me stabilize.
Hopefully this can help others as it's helped me.
Here's a link for more info on the song if any one is interested:
http://en.wikipedia.org/wiki/Tomorrow_Never_Knows
And the lyrics:
http://www.lyricsdemon.com/lyrics.php?songid=87140