Wether you want to work out, eat healthy, journal or sleep before 10, forming a habit is often the way to go. We're routine creatures, so making something into a habit helps us doing things consistently. It's the momentum that overcomes friction, the friction of having to start anew.
Like staying sober, counting the number of consecutive days or weeks that you maintained this behaviour can help. People have an inherent desire to be consistent, so if you managed to run twice a week for the last 40 weeks, this is extra motivation not to break your 'streak'. Tons of mobile apps are aimed at registering your streaks and motivating you not to break it.
I recently read a tweet saying that no habit is a real habit unless you failed at your streak and re-started it at least once.
This made me think of losing your focus during meditation. Letting your thoughts run away with you is something even experienced meditators have happen to them regularly. The trick is not to feel down, but just be glad that you noticed, and then re-focus your attention to your breath.
The analogy that I like best for this meditative exercise is that of a mother dog with a nest of puppies. Every time a puppy runs from the litter, she patiently wanders off, grabs the puppy and brings him back. No annoyance, no irritation.
Which might be a great exercise for your desired behaviour as well. If you have a clear motive for your behaviour, a clear 'why', picking up your puppy and bringing him back to the nest can be a loving experience.