This has worked for me:
Split the task into smaller parts
Remove all distractions
Do a pomodoro sprint
The pomodoro technique is well-known. I don't use it in the classical sense i.e. I don't do only 25-minute slots. Given the tasks at hand, I try to estimate the time I'll require for it and schedule it in my calendar. The part that I follow from the pomodoro technique is to set aside 5 minutes after every task to spend on activities like checking email or twitter. This ensures that I never feel that I'm denying myself any guilty pleasures. The time sinks are available to me, just at a later point in time. Because the next sprint is set to start within 5 minutes, I know that I have limited time and end up using that slot judiciously.
The interesting thing is that I use this technique sparingly. When my to-do list becomes very long, I pull out this weapon from my arsenal and it usually works well. But the next day, I tend to get back to my regular approach of taking up tasks one by one, without scheduling slots in my calendar.