Does your PC 'shutdown' (ie. properly) or does it just switch off immediately as if someone has pulled the plug out? If it's the latter, it's most likely an overheating CPU as mjwman has said.
If you feel confident, open up your computer's case (I'm assuming you have a desktop and not a laptop) and have a look at the fan which should be clamped onto the CPU. If it's full of dust give it a clean and while you're at it, clean out any other bits of dust which might be clogging up any vents, etc.
I had a similar problem a couple of years ago with a laptop. After taking it to bits and giving it a good spring clean it worked okay.
Hope that helps. Good luck.