It would help if you described more precisely what exactly is the problem for you. More precise questions often lead to better answers.
It's easier to change something if you measure it. So you could start by living one week as usual, just with a pen and paper in your hand, and writing down as many interruptions as you can -- time of start, time of end, who was it, how was it (personally, e-mail, Facebook). At the end of the day, try to grade each interruption how much useful it was.
At the end of the week you should be able to identify the main sources of useless distraction. You probably can already guess it, but still the real numbers may surprise you. For example you may think that you spend 1 hour a day at Facebook, but your report shows you it's more like 7 hours a day. Or you may notice that 80% of online conversations are with the same person. Then you will know where exactly to focus.
The easiest way to resist temptation is to avoid temptation. For example if you want to limit your time on Facebook, turn off all e-mail notifications from Facebook. Then you will visit it only when you decide to. -- If Facebook sends you a lot of e-mails regardless of your settings, add an automatic rule to your mail client to mark all incoming Facebook e-mails as read (this part is very important), and put them in a special folder, where you can read them later, if you want.
Generally, treat your attention as a precious resource (because it is), and build some firewalls to protect it. -- If you are deciding whether to visit Facebook now or later, you have already lost. You win if you forget that Facebook even exists, until the moment you need it. -- Every automatic reminder is like a kick in your head; do all you can to block them all, without exception. Choose to interact only with humans, and only when they want to interact specifically with you (not when they just want to broadcast some message).
It may help if you keep a written list of your goals, and every day remind yourself that you can either work towards your goals, or get distracted; but can't have both in the same day.