Try replacing the thermal paste on the CPU
Sounds like the computer is over heating
I have my friends computer to reformat for him, so I went round to his yesterday to pick it up and it was on, so he shut it down etc.
I brought it back to my plugged all the writes in, monitor, power, keyboard and mouse, turned the power switch at the back on - the computer started for about 5 seconds and went back off, I didn't even press the power button on the front of the computer.
So I came to the front of the machine and pressed the power button and nothing happened, so I took the power cable out the back of the machine 5 minutes ago and when I plugged it back in the machine started up for a few seconds with the fans going and lights on the motherboard and then switched off again
Any idea how to fix this?