A software (stress) test for the CPU, assuming that when you tried to boot into safe mode the GPU wasn't included we can ignore the GPU.
If this doesn't provide what we want to see, the cause, then you may have to strip down your system.
There are 4 software tests, for the GPU, RAM, CPU & hard drives, for the other components you have to replace them to test them, with the PSU you can test the voltages also.
Unfortunately I'm a bit limited in giving support when it comes to hardware, if required I'll ask someone to come in for it
Run Prime95 and/or IntelBurnTest to stress test your CPU. Prime95 - Stress Test Your CPU - Windows 10 Forums & CPU - Stress Test Using IntelBurnTest - Windows 7 Help Forums
If you're overclocking anything, please stop it and set everything back to default while troubleshooting
Your CPU temperatures will rise quickly while under this stress test. Keep a keen eye on them and abort the test if overheating occurs.