Here is what I do :
Go to the bed before 12am and wake up early. You will become more productive if you get up early and start working.
Listen to music. Keeps you concentrated.
Keep a paper/notebook with you. As developers we are often confused. Write down what you think, architecture, algorithms etc on a piece of paper and believe me you will have a great clarity of thought.
Walk for a few minutes after working for some time. As @Kleo suggested follow 52-17 rule.
Avoid (long) meetings. They are counter productive most of the times.