PC switching off Unexceptedly

It could happen between a period of usage from 20mins to a few hours. Earlier on today it went off on two successive occasions - after a 20mins period and then after a period of one hour. Last night it lasted for about 4hours before going off.

No problem booting up. Yes I cleaned the dust out of the inside and ensured that power cable was securely in place. Could it be the power supply?

I eventually did get round to removing the CPU fan. It was a tricky task and I cleaned out the thin film of dust and put it back together. I switch PC and it worked for just over one hour and powered off again.