I suggest just listening to your fav. solo artists, especially jazz players. Even though the musical qualities of the solo are complex, there is still a often subtle melodic tune behind it. The melody is the most paladable thing to the ear, and since the guitar solo takes front stage. It must have some melodic interest. If not it's dull and really does carry you anywhere.
As for writting your own solo's. It's just another one of those things that the more you do it the better you get. But if you keep "the singing tune" in mind, you're solos will progress much faster and be more enjoyable. Another thing that will help is analyzing the solo's you already know. Learn both the rhythm and lead parts and see how they interact. Look to see what chord the rhythm is playing, say Aminor. Next look and see what notes are in the solo while that chord is sounding. Go through the whole solo and pay attention to this interaction in as much detail as possible. You'll learn alot.
Apply what you learn, keep a singing tune in mind, and just keep writting. That's my advice.
"My whole life is a dark room...ONE BIG DARK ROOM" - a.f.i.