I have the same problem, too. I can never play perfectly because I make mistakes all the time, sometimes on parts of the piece I already could play, or at times, the easy parts!
I agree with all the above comments, and have tried to practice little by little, taking note of the passages I commonly make mistakes at (sometimes, I play it okay out of sheer luck) and then trying to half-memorize, or memorize, those portions. I noticed some improvement, and my confidence has been building.
In addition, I did notice that sometimes, it's because a part of my mind is wandering. I don't focus, especially when it's the "easy" parts that I already know. It takes some discipline for me not to play mechanically, and I do get a bit lazy! Of course, sometimes, it's just tiredness, or fatigue. I'm still working on it, though!
I'm glad I found this thread. The responses are very helpful.