There are 2 things that could be causing this:
The system is likely over heating either due thermal paste not pulling the heat from.the cpu to the heat sink or the cpu/gpu fan might be faulty, can you hear the fan when you turn it on?
The other issue might be that the psu is failing, this isn't very likely as a psu would normally have a protection circuit to stop it powering on at all if faulty but it depends on how the psu is failing.