ear training

practice learning what each possible interval between any two given notes sounds like.. and how to play that interval in multiple ways on the guitar.. that's the best way there is.
 
Yeah, James pretty much nailed it right there.

What I find good to do for a start, for instance if tabbing a solo and it's oriented around mainly one or two octaves. I get familiar with the notes on one string and all the intervals between them, because it's a fairly linear semi-tonal progression from fret to fret. I then attempt to identify the notes of what I want to transcribe with notes on the actual string and just go from there. Change the notes to different strings to enhance playing ease etc. etc.

That's just my way.