There is always an element of frustration when practicing (or should be) because you should practice things that you are not good at. There is often a tendency to practice things that you can already do because there is the immediate reward of playing something that sounds good, but this makes progress slow. If you practice what you can't do, gradually these new things will make their way into your actual playing. This takes patience and some tolerance for failure. Nobody, except maybe your teacher, should ever want to listen to you practice.
The problems you describe in your playing sound like the result of not knowing the material well enough. You may think that you know it, but not really have the material in your fingers so when you rush ahead at a performance tempo your technical chops can't keep up the pace. Or you may be finding that the stress of performing puts you on the spot, overloading your brain so that you lose focus.
One way to improve the situation is to really get to know the music you want to play. Play through it with a metronome as slowly as needed to get every detail right, before gradually increasing the tempo until you reach a performance tempo.
Another tactic is to visualize the music, without an instrument. Close your eyes and imagine playing your instrument through difficult passages, visualizing the fingerings. Picture the chord symbols in your mind; if you can read music, visualize the notes on the staff.
Spending some time analyzing the pieces that you play may also help you to avoid losing your place when performing. Try to analyze the chord progressions, the melodies, look for how the melody relates to the harmony, look for repeated phrases, identify the song form, etc. The more ways that you have to think about a piece of music, the easier it will be to remember it.
When at the instrument, try to focus more on listening, and less on visual patterns. When in a performance situation, this will help take your mind off of your surroundings; when playing with other musicians, you really need to be listening to the other musicians as well as to your own playing.
One nice way to warm up before a practice session is to work on tremolo picking. Set the metronome to a relaxed tempo, say 60 bpm (or slower if you like; surprisingly very slow tempos can sometimes cause problems). Pick any note, and just play that note using alternate picking. Quarter notes at first, one note per click. When you get locked in to the metronome, switch to eighth notes. When you get locked in again, switch to sixteenth notes. When you get locked in this time, increase the tempo (say, from 60 bpm to 70 bpm), and start over with quarter notes. You can pick a new note for the new tempo if you like. Keep doing this, and increasing the tempo until you find the tempo at which you begin to lose control. This should only take 10 minutes or so, but within a week you should start to notice an improved ability to play with the metronome.
You should do this in different locations around the neck; you don't have to do it everywhere during each practice session, just don't always practice this (or anything, for that matter) in the same location. Use open strings sometimes; the strings respond differently to the pick depending on where they are fretted, and practicing tremolo picking on different strings with different notes helps you develop a feel for this. When you gain some proficiency with the original exercise, you can add triplets or sextuplets, pick groups of five or seven notes, add 32nd notes or 64th notes, or expand the exercise in any way that seems helpful.
Above all, don't give up. The road to mastery has no end and there is no clock to punch. If you need to play music, then do it.