The common cause for computer rebooting randomly is the Graphic card overheating or driver issues, a virus or malware issue and the power supply issue.
There are a few things that you can check which are given below in the methods
Method 1: Turn off Automatic Restart Feature
Hold Windows key and press R
Type sysdm.cpl and press Enter
Select Advanced tab
Click Settings from the Startup and Recovery section
Uncheck the option Automatically restart option in System Failure section
Click ok
Method 2: Check RAM for issues
The first thing you should do is check the RAM. A faulty RAM can also cause the issue which is easily traceable. You can check the RAM with the MemTest86 or you can do it manually by putting one RAM stick at a time to check which one causes the restart.
Method 3: Check your PC for overheating
You should also check your system for overheating issues. Your system will restart automatically if it overheats while running a certain program. So, if you notice your system getting restarted on a specific program or generally when you run a resource intensive program then overheating is the most likely cause.
Method 4: Check and replace the Power Supply
Lastly, you need to check power supply unit for any issues. Your power supply is responsible for providing the power to all the components.
Method 5: BIOS Update
Although unlikely but not entirely impossible, the problem might be caused by an outdated BIOS as well. If you have your computer for a very long time and you haven’t updated your BIOS then checking for an update is worth a shot.
Method 6: Re-installing Drivers
Sometimes, the issue might be caused by incompatible or outdated drivers especially if the issue started happening after an update or upgrade. Your graphics card driver is the most likely cause of random restarts. So, uninstall the graphics card driver and let the Windows download the most compatible drivers for it.
Method 7: Changing Power Options
This solutions seems to resolve the random restarting issue. Basically, you will lower the minimum process state to almost 5% which will prevent your system to randomly start.
Hold Windows key and press R
Type powercfg.cpl and press Enter
Select change plan settings from your selected (active) plan
Select Change advanced power settings
Double click Processor power management
Double click Minimum processor state
Select 5% from the range menu. Do it for both plugged in and battery as well.
Select Apply then Ok