If you are keeping an application like Safari open and constantly running for multiple days at a time, this is the reason itself that is causing you the issue.
When you quit an Application, not close its windows, but actually quit it by either clicking on the name of the application in the top left hand corner and choosing quit or by hitting Command + Q while in the application, it will free up its RAM and resources that it is holding on to.
This happens a lot for people who don't like to restart their machine and constantly leave things running or always open. Its convenient, no argument there, but it can bog down your computer because it is constantly holding onto everything you have been doing.
It would be similar to never cleaning off your desk, always keeping everything you need on your desk at all times. Things would pile up and pile up and get more and more cluttered. Its convenient because you have everything in arms reach but after a while, the time it takes to find things in the piles of stuff that you have becomes longer and longer. That is what safari is doing, it is keeping track of all the stuff you have looked at and watched and done on the internet, just in case you want to return to it quickly. By leaving Safari open and running for days at a time, it is lugging around so much stuff that even doing simple things becomes a chore.
Now I am not telling you to turn off your computer every time your done using it. Using sleep mode is fine, but just remember to quit your applications. An easy way to see what Apps are open is by hitting command + tab. If there are a lot of things open, quit them. If they are quitted, they won't show up in the little box that pops up when you hit command + tab. Restarting your machine is good to do every couple of days, because it lets the computer free up resources that it may be holding on to that you probably aren't even using. Its just part of regular computer maintenance.
Some people will say to never restart your machine and others will argue and tell you to restart it or turn it off when your not using it. Everyone will have their theories and opinions when it comes to this. The important thing to remember either way is that you need to quit the apps that your aren't using anymore. If you are putting your computer to sleep, and you don't need what was open anymore, close those applications, free up the RAM they are using, give more resources back to the computer so that when you pull it back from sleep, it will be ready to work, instead of remembering to lug around those things you don't care about anymore.
You can also google search ways to keep your mac running smoothly, and you'll notice usually in that list is the advice to quit applications when not in use.
I know this was kind of winded, but I hope it helps you keep things optimized and running smoothly.
Best Answer
To further diagnose the problem I would try creating a 2nd user account to log in with, while also disabling any kind of automatic log in if that is enabled for your normal account. This could be used to see if it is something specific to your user account.
Test to see if the machine can restart from the login window or the other user account.
If it does then there is a User account problem occurring, and you can try to manually locate what the problem is by doing manual house cleaning tasks.
If the problem still persists I would try seeing if when you boot your mac into Safe Mode and see if the problem still exists.
If it goes away then there is some kind of third party driver, etc that may be causing the issue. See more information on what Safe Mode does to find out where to look to troubleshoot next.
If all else fails a very good solution in this case is to backup everything to an external drive, and then do a clean install of OS X. Then you can import just the files you need using Migration Assistant or manually.