As mentioned before, it is always a good idea to have some definite theme in mind when you start improvising. The theme could be purely rhythmic or could consist of certain notes, or a phrase containing a strong accent on a certain note for example. Here is an example of developing a theme.
The theme here is very short, consisting of the third string notes E(5),G(b7) bent to A(1) and the A on the second string.
This next phrase is a development of the theme. The notes are repeated but instead of finishing there, the phrase keeps going down the scale with one more bent note in the middle, before coming to a rest on the lower A(1). The phrase then returns to the high A twice. This time the two high A notes are on the second beat.
This exercise should help you to gain control over the change in fingering on the 3rd string.
Look through some of the other solos you have learned for other examples of developing an idea. Comparing music to written language, you could say that a lick is a phrase, which means it has to fit as part of a sentence or it makes little or no sense. Licks are just a starting point for development. You never hear a great musician wander aimlessly from one unrelated lick to the next. Everything a great player does make sense in relation to what has just been played and what is about to be played.
I believe the best way to develop this ability is to study the music carefully, be very conscious and analytical when practising, learning lots of ideas and developing them into phrases and solos at home, so you have really solid and varied musical knowledge. When you go out to play music however, leave all this at home. Try ears and intuition will lead you to the right place most of the time.
The great Jazz saxophonist Charlie Parker is reputed to have said "Learn your instrument, learn the music, then forget all that and just play". Good Advice!