Format and reinstall windows and get all the latest drivers to eliminate software issues first.
Then run diagnostics on all your parts. PSU tester for PSU, memtest for RAM, hdtune for HDD, try GPU in another computer. I recently had the same problem and it was my RAM