Have you ever cleaned the inside of your PC? Dust drawn by the fans can cause overheating and will shut you down.
Very good point. This happened to my mom's pc. All that was needed was to vaccum out the dust. It works fine now.
The dust would cause it to shut off (sometimes after 5 minutes of running or 20 mins or 45).
Worth giving it a try. I have a hunch that's the problem.