In a recent post on Litopia, evmurphy asked how people manage to stay on task, rather than get distracted when researching on the internet. It's so easy, she says, to go off on a tangent that leaves the work in progress far behind. She suggests having a separate account on your PC for writing that only has the writing tools in it, so you have to switch out of it to get online.
For me there are two potential problems that get in the way of writing. One is prevarication. Pretty well every writer I know, however much they love writing, will put it off with anything and everything, including blogging, reading internet posts and so on. I handle that by having strict time slots. I allow myself a bit of prevarication after breakfast before getting down to the grind - but no more than half an hour.
The second - the problem evmurphy describes - happens during the research part of the writing process. Here the writer gets so interested in tangential material they don't get back to writing. This, I'm afraid, I haven't really experienced. Once I am writing (and I'm including the research part), I get really carried away with what I'm doing and am not easily distracted. If I see something potentially useful/interesting but irrelevant as I research, I slam it into OneNote, but then carry on with the topic at hand, because that's what is filling my mind right then.
It's not really a practical solution, but I think the answer to that second problem has to be to love writing. Once you get started on it, it should pull you in and preserve you from distraction. You can still very easily be put off starting the writing, but it's much harder to get waylaid while doing it. How to love writing? I'm not sure it's something you can learn. Most of the writers I speak to describe some sort of compulsion to write. It's not optional. Without that drive, maybe writing is not for you.