You could try undervolting the CPU with Intel Extreme Tuning Utility (XTU) - lowering the voltage by ~0.1V decreases the amount of heat produced, which leads to less CPU throttling.
Please correct me if I am wrong. Intel Extreme Tuning Utility (XTU) seems to be Windows only and I was unable to locate a Linux version. For Intel Haswell generation CPUs and newer I've had great success using the following utility under Linux to undervolt my Dell Precision 5510: https://github.com/tiziw/iuvolt
Drop it too low and the machine may crash under heavy load, it won't (with a high degree of probability) cause any permanent issues (it's somewhat safer than over volting).
at the offchance that someone knows the answer to my problem: when undervolting everything works fine for me until I lock my PC(Windows). It then proceeds to restart itself. Am I undervolting too much or is this something else?