How can I restrict the amount of time I spend on particular websites?

Solution 1:

There are lots and lots and lots of different filtering programs—most, understandably, concerned with blocking adult content, and many of which cost some chunk of money.

SafeSquid appears to do what you want (amongst other things), and they have a free version for 3 users or less. I have no idea how easy or difficult it is to set up.

Solution 2:

If you use Google Chrome, I strongly recommend the StayFocusd extension. It's proven to be extremely useful for me (mainly as a productivity tool). As with any Chrome extension, it takes a second to install and 30 seconds to configure the options - choose how much time you want to allow yourself to be on Facebook and other sites that you class as time-wasting.