I try to quit when I'm stuck. Because when I'm stuck, I'm not really stuck, just tired. I think about my problem in bed until I fall asleep, and wake up often much closer to the answer.
If I get stuck significantly before bedtime, I take an extra shower or a walk or something, and that often has the same effect.
This works for me too. In addition, going for a coffee helps, as does splashing some water on my face.
In addition to quitting when I'm stuck, I also quit when I achieve. A git commit produces a nice starting point for the next day, and I have the Mortal Kombat guy tell me 'excellent' as a post-commit (yes really). Then I leave the startupcave feeling like a boss.
It's probably really emotionally satisfying to quit on an achievement, but I find it a lot harder to re-enter the next day without an unsolved problem. If I have an unsolved problem to start with I can build enough momentum to go into virgin territory, but starting the day without an unsolved problem can lead to hours of that blank page, writers' block, "what do I do now?" uncertainty.
I have a bunch of paper with checkboxes. Two or three check boxes a day, make that tick, hear the MK guy. But next day I've got another empty check box that I'm going to attack.
If I get stuck significantly before bedtime, I take an extra shower or a walk or something, and that often has the same effect.