You get the idea, the mind is complicated. It is an interactive and reactive machine and it can lead you into some wild places in the blink of an eye. Likewise a practice session can go south with a lot of tangental and distracting thoughts. Part of this is a good thing, because the mechanics of these mental processes are used when you're in the act of performing, and requires access to a lot of different information at once, quickly. So how to you hone and harness this process and get it started on the right foot?
One of the things you should do is listen to your favorite music before you start practicing. This can be inspiring enough to lead you straight to the instrument with a clear head and positive thoughts of the possibility of you approaching being able to play like that...eventually.
Work on something you have difficulty with. But approach it analytically. Learn to isolate down to the smallest detail. A left hand fingering, a hand preparation, a small transition. Realize you are asking a great deal of the brain to play a passage. It is doing things faster than you can think about and is relying on the information you supply it.
Be prepared to work through a block. Apart from the regimental things you might do when practicing, one of the things you are seeking is a complete and direct communication with the sounds in your head and the process of translating that to the fingers. You are seeking a state of doing, not think-doing. Until you start approaching that, you are not operating with all of your faculties available.
Try to avoid repeating a passage over and over again wrong. A mistake can be remembered as well. Remember the process of playing is literally drawing on mental-physical copies of the task programmed in. So if you put in a bunch of bad copies, like a computer, your chance of retrieving a bad copy are high. You want to basically overwrite a bad copy with enough good copies (your mind has no delete, empty recycle bin button that I know of. Although Tom Cruise might insist there is.
Try tranposing things you learn by ear. In the case of songs, this leads to an overall sensation of "distance" to travel on the keyboard. Eventually it becomes a physical act of interval distance recognition by feel. The feeling of being able to play anything in any key by ear leads to a general increase in confidence level in playing situations. Like Staples, "That was easy" goes a long way for the psyche.
Practice playing with your eyes closed. Take note of what you miss, but also note how much many ideas you can play correctly by touch and body distancing. Blind people can play. So can you. You might find you are much more focused on the sounds and the physical job when your eyes and all of its distractions are disengaged.
Make sure to pick-up where you left off when you practice. If possible notate something that you can go to. I recall recently an exercise I devised for left hand 3 voice chords that I was sure I would remember. I didn't.
Record your practicing. With all the latest gadgets that is becoming easier to do. It's painful but it does give you a more objective viewpoint on what you sound like. If too painful, listen to it in a few days. Remember you are using the recording as an unedited document of your experience. You locate a point where you were trying to do something and you sit down and redo that moment again so this time it does what you wanted it to do.