Haha, real question now. When you start to lose it in the middle of a solo, what do YOU do?
Well... as many masters have suggested, one simply stops. Stop, take a breath. Listen. Listen to everything around you. Then say to yourself, "As a listener and fan of music, what would i like to hear right now? What would serve the music well at this moment?"
Then play that.
Play what you hear.
And if you can't sing it don't play it.
c",)