I pace myself when I work. I know exactly what my body and brain can handle at any one time, so I budget my time accordingly. I also try to take frequent breaks during a work session. I usually get up and walk around every hour or so, mostly to stretch, get a breath of fresh air, and clear my head. Naturaly, there are times when I just lose myself completely in my work, but having my girlfriend around reminds me that I do need to take breaks on a regular basis.
Switching gears is another good way to deal with or overcome burnout. Work on another project, read a book, go watch a movie, go out and spend time with friends, whatever. If you're in the middle of a project with a tight deadline, it is still important that you step away from the computer for half a day or even a whole day and do something that takes your mind off of the project. When you come back to work, you'll be refreshed and ready to go again.
You get better at pacing yourself as you gain more experience. You need to really pay attention to how you work so that you can adjust your work pace to suit the schedule (or vice versa) without hitting burnout so often.