This is the kind of problem that can only be solved by a process of elimination.
Here is a list of possible causes: -
a)Faulty PSU (Power Supply Unit).
b)PSU is running at maximum capacity, and the overload trip is shutting off the power.
c)CPU is overheating and cutting out.
d)Graphics Card is not tightly seated into the MOB socket.
1st check out (d) above.
2nd check all connections in the case.
3rd make sure all the fans are operating OK.
Once you have made sure it is not a hardware problem, then you can start investigating the software.
Please supply details of your PC.