Music may help as several others have mentioned - personally I find classical piano or organ music works well; but I also use a white noise generator instead sometimes, so that might be worth trying too. Somehow it's good at drowning out the little distraction "what's on HN now" itch. I use "A soft murmer" on Android, but I expect they're all much of a muchness.
In contrast, if I have the music blasting (rap, techno, rock, anything really) then I can accumulate hours of consecutive work, and get into the flow state.