Simply become older. The older I get the less I want to do hours long sessions. But practically, I have a hard bedtime alarm on my phone, which works cause sleep deprivation and work suck.
Before you start playing, set an alarm on your phone for when you will stop. When the alarm goes off, do not say "I'll just finish X before I stop" else you won't stop. Just save the game and turn it off. You could also set another alarm five minutes before to give you time to finish what you're doing, if you want.