Most likely the problem is caused by an overheating CPU or possibly a weak/failing power supply. We suggest to open the case and clean it of all dust. You should pay particular attention to the CPU cooling fan and heatsink. The cooler should be clean in order to provide the correct temperature to the processor.
We suggest to test your computer with another power supply to see if the problem is still exists.