|Slow down! When you are learning a piece, slow it down!
If I only had a nickel for every time my teachers have told me to slow down!
When you are having trouble with a section of a piece, slow down. Slow down until you can play it perfectly while keeping a steady beat (Use a Metronome!). It is far more important to play it perfectly when you are learning than it is to play it at speed, but with errors. If you do that, you are only ingraining the error, and making that bad habit even stronger.
Once you can play it well, speed it up a little. When that speed becomes comfortable, speed it up again. This is a time when a metronome becomes helpful. The natural tendency is to speed up, but the metronome helps you to maintain a steady pace.
Continue that progression until you have it cold!