Repetition also helps. A lot of the music my band does is blues, so we're generally doing a 1-4-5 chord progression. Knowing that this is the case, I typically come up with a "default" improv and perfect it. Once I have perfected it, I can add and take away depending on the mood of the song.