1) don't waste cognitive energy on silly tasks (games, arguing in comment threads, etc.)
2) practice exercising willpower - it's a muscle, you can train it to be better. Start by forcing yourself to complete a routine every morning (the trick with habit forming is to not give up after you miss a day.) examples of habits to form below.
3) look into mindfullness meditation[2] - this can help you identify distracting thoughts as they arrive and practice ignoring them.
Meditating is a good habit to form as practice, and it will also help you get better at habits. You could also exercise on a schedule (and record when you do, including how heavy you lifted/how fast you were running). Eventually, with a stronger willpower-muscle, you'll be able to choose the fruit salad over the cake, even when you've just spent your 7.5 hours a day coding.
I've not found pomodoro to work for me as an easily-distracted person, it's better when you're prioritising work tasks (e.g. 25 code vs 5 email) and even then, 25 mins is too short for good programming "flow".
This is a hard problem, everyone has trouble with it. Good luck!
[1] http://seriouspony.com/blog/2013/7/24/your-app-makes-me-fat (HN discussion: https://news.ycombinator.com/item?id=6124462 )
[2] http://www.amazon.co.uk/Mindfulness-practical-guide-finding-... (US edition: http://www.amazon.com/Mindfulness-practical-guide-finding-fr... )