I have a couple of hobbies that require me to be in the moment and not think about other things - particularly rock climbing and FPS gaming. Both require enough concentration that I tend not to think about other stuff. I also do a bit of cycling, but when the road's clear my mind can wander a bit.
Another thing than can help is to intentionally do some kind of "leave it behind" ritual, where you mentally leave your work day and change to your own time. I try to find something in my commute - ideally walk part of the way and use the movement to help that sensation of transition.
Also simple stuff - take work email, chat etc off your phone; leave your work laptop at work. Maintain a separation of spaces so you can mentally switch. Coming back to work rested is important.
Ultimately - have "non coding time" where you do something else. Doesn't really matter what, but if you have no downtime you'll be less effective when you're trying to be on your game.