I suspect your hard drive is starting to go. A slow system tends to be a system waiting for a process to complete (reading/writing to disk).
If you want to try to salvage your disk you'll need to boot up under an external drive and run both permission and disk repair within Disk Utility. You'll likely need to run it a few times to clean out all of the errors.
If this doesn't help you'll need to scratch the partition and run the ones & zeros test so the bad blocks can be isolated out. Then re-install the OS and your backup. In the end you do want to leave at least 1/3 of the disk free so the OS can use it. When you get as tight as you got with only a few GB free you do hit the limit of the OS ability to run.
Or, if you want to get a better drive I would recommend going with a SSHD hybrid drive Vs a standard HD or even a SSD.
SSD's are on the small side for what most people need as a single drive solution. Given the fact you already had a full disk (500 GB) I think you'll find you won't have the needed space with a 512 GB unit. Going to a larger SSD will be a big pinch on your wallet, which is why a SSHD is the better option here! It give you the zip of a SSD but give you the deep storage of a HD and you won't drain your wallet either! Seagate makes a nice one, Here's the Seagate product guide: Seagate Laptop SSHD, and here's the spec sheet: Seagate SSHD spec sheet. And here's the IFIXIT guide on replacing the drive: MacBook Pro 13" Unibody Late 2011 Hard Drive Replacement
As to upgrading your memory it can improve things! Depending on what you are doing going to 8 GB may make sense for you.
Lastly, upgrading the CPU is just not possible as its soldered to the logic board.