sound Like a heat related problem could be the CPU fan power supply
fan. Check for air blowing out of the power supply fan see if it
moving air. Also check the CPU fan see if it spinning or moving air if
not get a can air dust it and clean out the Heat Sink, CPU fan. Same
goes for the power supply fan. As for the power supply being bad and
testing it with a power supply tester the tester may show good even
when the fan is working.
Try manual Spinning the CPU & Power Supply fan when the computer is
off you can usual tell if there is friction in the fan.
Try this leave the side panel off have a fan blowing directly in the
computer see if the computer shuts off or freezes up.