Be in tune. If a guitar is disastrously out of tune, it won't matter what is played on it. Using an electronic guitar tuner is an easy way to tune a guitar quickly.
Get a great tone. Imagine Jimmy Page's solo on "Stairway to Heaven" sounding as if it was played through speakers made of tin foil. It is easy to ruin a lick with horrible tone. If you are playing an electric guitar, make sure the treble knob on your amp is at a conservative level. Turning the midlevel up will thicken your sound and give you some punch you may be looking for.
Also, try boosting your sustain with a compression pedal. The longer your notes last, the more expressive you can be with them. On an acoustic guitar, experiment with using different picks or just your fingers to get the right tone.
Know the key and chords to the song. Being aware of the key as well as the song's chord changes will prepare you to play a great lick without fumbling around in the wrong key first.
If you are playing in a group, pay attention to the rest of the band. Locking in your licks with the rest of the players is essential. Playing just a few notes on the beat is much more effective than playing a zillion notes out of time.
Play something you can sing along with. Think of your favorite guitar riffs. Chances are, you know their melodies by heart. This doesn't mean that you can't be creative in your note choice. Go ahead and flat the fourth, but do it with purpose. Make it memorable.
Don't worry about showing off. While a lick may be your time to shine, most people are not going to care if you can play the Dorian mode faster than Carlos Santana. Focusing on such things will make your fills and solos sound like practice sessions rather than music. Pay attention to other guitar players and see how much this happens.
Have fun. Music is entertainment. If you aren't having a good time doing it, how can anyone enjoy listening to it? Following this simple rule will have you playing great licks no matter what level you are at.