For me, what helps is messing around with "side projects" that are not perhaps officially sanctioned, but are tangentially related to my job. You'll want to be careful with these, some bosses may not appreciate it, but perhaps it's not programming that's the problem but the company you're working for...
So for example, hacking into our software to expose security flaws. Spent a day screwing around and turning a "theoretical" problem into a real one and upping the priority of security in general.
Reading up on SQL... on a paper book, out in the sun by a pool.
Setting up a testing framework and getting coverage up from 0%. (Sad I know)
Refactoring code that just bugs me.
Learning about password cracking and *ahem* verifying the suitability of our hashing algorithm.
Playing with VMs and setting up a proper dev environment.
Googling around for hacks and cracks for our stuff.
Okay so most of these are perfectly normal software development tasks, but the trick is, I didn't get permission to do them. They're far enough away from my usual work that I can switch over to them instead when I'm tired of the long haul project that never seems to end.
It's not making a NES emulator on my spare time or anything, but taking breaks and switching around can keep you from total burnout.