The Pomodoro Technique has helped me a lot staying focused on my work and studies. Sure, it's not a silver bullet solution to manage distractions but it's a good starting point.
What very often happens, however, is that since I have focused so well during that period, I actually end up completing the task, usually with a few minutes to spare. Feels a bit ridiculous, but, at least in my case (anecdotal, for sure), just giving my brain the 'peace' in knowing that it will only have to focus deeply for 30 minutes seems to help it immensely. Human beings are so strange.