To expand a bit on Pete's take.
When I improvise i try not to think at all but put all my focus on what others are playing. If I know the song, I just try and play something melodic and if someone plays a #5 right next to me hanging on a 5 I think I just react to that tension and try to go to somewhere meaningful. If its just a quick passing tension then I doubt I react to it at all. I know that if i think or let me ego get involved in playing I will sometimes reach for something that technically will push my limitations. If I relax and stay in the zone, more often than not something passable comes out.
If I am playing something from a chart with lots of unfamiliar stuff, at my stage, I have to think about what I play and I feel I sound stilted and technical. Hopefully one day I will have enough technique that I can fake that.