Paul Graham has an article on distraction and their effect on procrastination. The most important things worth mentioning are:
After years of carefully avoiding classic time sinks like TV, games, and Usenet, I still managed to fall prey to distraction, because I didn’t realize that it evolves. Something that used to be safe, using the Internet, gradually became more and more dangerous.
If I’d spent a whole morning sitting on a sofa watching TV, I’d have noticed very quickly. That’s a known danger sign, like drinking alone. But using the Internet still looked and felt a lot like work.
The key seems to be visibility. The biggest ingredient in most bad habits is denial. So you have to make it so that you can’t merely slip into doing the thing you’re trying to avoid. It has to set off alarms.
I’ve found a more drastic solution that definitely works: to set up a separate computer for using the Internet.
When I have to sit on the other side of the room to check email or browse the web, I become much more aware of it. Sufficiently aware, in my case at least, that it’s hard to spend more than about an hour a day online.