Could you identify in what moment the PC restarts or it is just random? Does this depend on the program or game you are running? Does the issue persist in Safe Mode?
I would recommend you to try using a system restore point. Check the link below for some more suggestions are details:
If you are not able to run Windows and to navigate normally, you should use a Windows installation drive and boot from it. Select the Repair option. It may fix some minor errors without harming your data. After the process is finished, restart the PC and try to boot normally.