Keep your computer in a place where it will not tempt you (a room other than where you study, or, even better, a different building).
Study in a library and tell yourself how long you will spend there (include breaks!). Public libraries almost always have desks you can use, and big ones open late. If you don't need a laptop, don't bring one. If you do need one, you might find that the gentle feeling of being overlooked is enough to stop you from getting distracted. Use public computers in preference to a laptop when it is possible to do so (i.e. no queues, right software available).
Give yourself a specific time for using the Internet for non-study purposes so you can release your urge to browse.
De-converge. Many functions have ended up being converged into computers. Use a stand-alone music player (e.g. Hi-Fi, old-style iPod with no internet), write things by hand and only word process the final version, use a paper diary instead of a digital one and watch TV and films on... a TV. In many cases, the "digital" version of things isn't all it's cracked up to be, so you won't lose out on much and could stand to gain a lot. Buy a cheap "dumbphone" to use as your main phone, saving your smartphone (if you have one) for times when it is actually necessary (e.g. you might decide that the time when you will use the internet for pleasure is on the bus using a smartphone)
Never use the internet just before bedtime. Whatever it is, it can wait until tomorrow, because without proper sleep you cannot do anything. If what you wanted to use the internet for was nothing important, you will forget about it or lose interest. If it was important, it will still get done.
Never sleep in the same room as a computer. You will wake up and go straight on it. Tuck it away in the kitchen or somewhere like that and tell yourself you will not get it out on impulse. It is easier to resist the urge once you have woken up a bit.
Recognise that it is completely socially acceptable to:
Check your emails only once a day.
Check Facebook only once a week.
Check LiveJournal less than once every two days (for example only; I don't use LJ, so I don't know how long is sensible).
Consider whether the things you are doing on the Internet are actually useful or valuable to you on a fundamental level. Some of them might just be a waste of time. Remind yourself of this when you find yourself using them.
Always get out of the house every day, even if you don't need to. It clears the mind and helps you to get on top of your thoughts for the day. Ideally, be gone for at least thirty minutes. A walk is useful. You might not look forward to it, but I find it is always more enjoyable than I imagine it will be.
Consider Cognitive Behavioural Therapy. It helps you to take control of your thought processes and stop yourself behaving in ways that you consider unhelpful. You can ask your GP about it, or there are a number of self-help books available on the subject. I friend of mine cannot speak highly enough of a book entitled "Stop Thinking, Start Living". There is nothing wrong with getting this kind of help. The worst that could happen is that nothing will change.
Some routers have the option to block internet access at certain times of day for certain computers only (by MAC address or IP address). This could be an option, but make sure that you do not know the password for disabling the restrictions or you may find yourself cursing the blocked internet and saying "Oh for God's sake! I just need ten more minutes!" before logging in, disabling the block and carrying on for the next four hours. In general, I find that technical measures are less effective than some of the other things you can do to stop yourself.
Just some ideas. These are the sort of things I try to do that work for me, but everyone is different. I hope this isn't too long to read. I have tried to shorten it but I can't find anything else to remove!