Eliminate environmental and mental distractions.Start the day with a pleasant routine - shower & bagel, exercise, brisk walk, chores, whatever gets the blood flowing and the mind focused.
Make a plan. Know exactly what needs to be accomplished and how to accomplish it.Break it down and create a list.Track progress. Pencil and paper work well. Checking off each items feels nice; furiously scribbling out a particularly frustrating one feels even better. And it gives you that extra motivation you really need at the end of the day.
Stretch a lot. Remember to breathe.Don't set a "break time". Take frequent, short breaks when you're running slow, but ride the flow when it happens and don't be afraid to code for many hours straight.