I've found the easiest way to focus is to 'trick' my mind into thinking it'll only be working for 25 minutes.
I use the Pomodoro app[0] (and I love the metronome) with the original intent that at least this way I will be doing some work, even if it's 25-on, 5-off. What I usually find is that after I get in the groove for 25 minutes, I'm far enough into a problem that I want to work through it - and work away as I'd originally hoped I could.
[0]: https://itunes.apple.com/gb/app/pomodoroapp-simple-pomodoro/...