When this happens, does Windows complain that it was not shut down correctly every time?
I would suspect the power supply, or the power switch or the reset switch on the case.
500 watts is a borderline size for a power supply running 12GB of RAM, a GTX 630, and 3 hard drives. Not so much when it was new, but as it gets older. This is due to capacitor aging. The total output will get reduced by up to 10% per year depending on the quality of the capacitors.
How old is the power supply?
Another cause could be just a faulty switch in the case. The power and reset switches are dumb contact switches (they literally just touch two wires together). If these become sticky or faulty they can make unintended contact, which will restart the computer.
You can test this by disconnecting the switches from the motherboard and running like that for a while. You can start the computer by using a small flat blade screwdriver to contact the 2 PWR pins on the motherboard (where you pulled the case switch lead from.