Let’s try a simple two-finger pentatonic run that moves across and up the neck. You should be able to play the entire thing with your 1st and 3rd fingers. The lick uses the A pentatonic boxes, joined together as follows:
Easy enough, right? Notice in the third and fourth bars where the pattern varies; instead of the ascending sequence, the pattern reverses before ascending again. These sorts of back-and-forth sequences and pattern fragments add color and melodic tension, rather than just playing a predictable, repetitive scalar run.
So let’s add a little flavor to those spots where the pattern reverses, throw in some quick hammer-on/pull-off notes. Check out the variation below for the last two bars:
Sliding into the final note, and then holding it, resolves the run with a nice “vocal” quality. With solos and short melodic runs, it’s generally the beginning and the end which are the most memorable parts of the melody, so it’s helpful to throw in some stylistic elements in those parts.
As far as picking goes, you’ll notice that there are no picking indications given. The odd-numbered note groupings per string make alternate picking more interesting, but as soon as you internalize the pattern and position shifting, use hammer-ons and pull-offs as much as possible throughout. That will make the entire run sound more smooth and fluid.
Melodic runs like this are great for “connecting” the fretboard, and for getting between distant points quickly and smoothly. The wider intervals of the pentatonic scale are especially useful for these sorts of connector licks.