Don't waste your time with defragmenting unless it's been a year or two. Windows doesn't really need to be defragmented anymore unless you're putting on and taking off HUGE amounts of data in one go. As for your problem, many different things can cause a freeze up like you described. In this case, I believe it's software related. Try running things through the Chrome browser (as it has the least amount of hiccups) such as YouTube videos and the like and see if you can duplicate the problem. If not, go back to Opera or whatever browser you were using and try to cause the problem again. Until you know relatively what's causing the problem, it's going to be difficult to track down.
Now if it just happens all the time and randomly then it's likely either a case of malware or it could be hardware related. If that's the case, unplug everything but the essential equipment from your computer (mouse, KB, monitor, power) and try again. If the problem still crops up then it might be another issue related to internal hardware. If you're able to, remove the case and check to see that all fans are blowing (including the one in the power supply). You can verify if the one in the power supply is working by feeling for airflow outside the case.
Run MemTest to see how your memory checks out. Run it for several hours at least; the longer you can, the better. Get a temperature monitoring program and check temperatures. Good programs will let you know what's normal for your CPU compared to the amount of heat that's radiating off of yours. The difficult nature of the issues makes it almost impossible to find the cause. "My computer freezes" is a call I get on a daily basis and it really doesn't help anything because the client rarely took notes on when it happens and when it started happening. If they had, my life would have been easier, their bill would have been much lower, and the likelihood of me actually being able to solve the problem in a reasonable amount of time would be significantly higher.
EDIT: When it freezes, check the hard drive indicator light. Is it solid (meaning staying on) or blinking rapidly? If so, take notes on how long it stays like that. If it stays solid for minutes at a time then it might be either related to your hard drive or it's software related.