If practice isn't deliberate, you will not be vigilant about developing bad habits. Long, mindless practice sessions aren't really practice at all. So it's important that you address anything that might be distracting you or causing your mind to wander.
These are things that you hear that make it hard to concentrate, especially if they are sounds you are conditioned to respond to such as a crying child, a barking dog, or your phone. If you have other responsibilities and actually have to respond to the sound, then it would be better to find a different time to practice when you can be more focused (if that's an option for you). But if you have no obligation to respond to the sounds you are hearing, then block them out. Listen to natural sounds (birds or ocean waves work well for me) through headphones. Or listen to your metronome through headphones.
This one is especially difficult for me. Any sudden movements while I am playing will cause me to completely forget what I'm doing. Often when I perform, I have to do it with my eyes closed or choose something to look at because if someone opens a door, for example, it's really hard for me to recover.
For my students who are especially prone to visual distractions, I don't recommend practicing with anyone else in the room (including pets). Turning your back to the window is a good plan, and if you don't need to see the music, consider wearing a blindfold.
Telling yourself not to think about something isn't particularly effective, especially when what comes to mind is something you actually need to remember. Instead, try making a list of things that come to mind that you need to deal with but can't because you are practicing. Once it's on paper, you don't have to actively think about it because you know the list is there to remind you. And if you find yourself losing focus more often than not, it could be that your practice session exceeds your attention span. Try shorter sessions with a break between them, instead.