Add all those websites to your hosts file (Google it) so that the OS will not connect to them. Alternatively, get Ad-Block Plus and block all the websites you want to avoid. Then, when you're not working, you can disable ABP and go on them like normal.
That said, the best solution is to develop self-discipline.
Create a second account on your computer, have one for work and one for recreation, if you feel the urge to YouTube or MyFace then log out of your work account and log back into your recreation account.