With great difficulty.
To be honest when I've really got my teeth in a problem I mindlessly power through it until it's solved at the expense of everything else except feeding my cats. Sometimes I just get this feeling like I need to snap out of it for a while and go for a walk or gym or something - and when that happens, I often "magically" solve the problem or get an idea of what to try next during said walk.
The only thing I am diligent about is sleep. There are _very few problems_ that will prevent me from getting to bed on time. Sometimes I do go to bed at 02.00 after working on something really interesting that I can't stop thinking about, but then I try not to start the next day until 11.00 or noon.
I do also try to stay on top of my exercise, but this can also fall by the wayside for work. In the long-term, though, I've managed to keep up with gym (mostly lifting) for over ten years. But in the short-term, if I am stuck on a really interesting problem, gym is probably not happening that day.
I try to balance this by taking it easier when I can afford to, knowing that in the end my tendency is to work too much rather than too little. So when there are quiet moments I try to take them for myself and not worry about feeling lazy or unproductive in those times. This has helped greatly in the times when I can actually manage to do it. It recharges me a bit for the next burst of overwork and single-minded focus I'll feel compelled to put in later.
I don't think any tools will help me with this. It's purely internal. I know when I am fixated on something at the expense of everything else, so a tool to help me measure the balance or remind me won't help me change the actual habit.