Doing the easy thing and goofing off or taking a break can be exactly the worst thing to do, since you're creating a reward for not-laboring.
My remedy for burnout is to power through it by doing small workful things which are intrinsically their own reward (and not in the pithy sense, there needs to be a primary rewarding stimulus associated with success). When I was a biologist, this was often doing routine molecular biology for a week, seeing those colonies was gratifying (if slow). As a programmer, those green dots carry their own gratification and reward cycle; when I feel burnout coming along it's a great time to work on those refactors or unit tests you've been putting off.
I don't have major burnout episodes anymore, and haven't for the last six years or so (disclaimer: it could also be just maturity)