I had a similar problem not long ago, actually, and I discovered a stiff PSU fan to be the culprit. Granted, it's been six years since I've had this build. Anyway, I tried everything--uninstalling/reinstalling components to dust them, applying new thermal paste, etc. Nothing was working and, like you, OP, I couldn't play games for long before my PC shut itself off. It got so bad that it started to happen naturally while idling, too, and I could never keep it running long enough to diagnose problems.
After almost losing all hope, I decided to dust one more time and noticed my PSU fan wasn't spinning when I was using a heavy-duty duster. I had to take the PSU apart and lube the fan's rotator reservoir. And then it was fixed. CHECK YOUR PSU FAN.