Two immediate causes for this are "bad caps" or a faulty PSU that may contain bad caps or just itself going bad. If it re-powers back-ON, then that suggests you have the reboot from lost power-OFF when configured in the bios.

bad caps - Due to aging or bad manufacture capacitors will start to deteriorate and that's not unusual for electronics. However, these are found on the mtrbd. and just everywhere else. Google "bad caps" for examples and what to llook for.

PSU - It has reached a point where to wear&tear or exceeded power demands have caused an unstable operation

Replace or repair, but if PSU, that's easy replace with a similar or better capable PSU suited for your needs. As for bad caps, while that can be repaired usually the cost is far better spend on replacing unless your're capable of such repairs.

tada -----Willy Happy