1. Check Power and Battery Settings.
Make sure that your laptop is set to never sleep on plug or turn off/on when not on battery.
Check the power settings in the control panel or settings.
2. Uninstall Problematic Drivers.
Open Device Manager and check for driver updates.
Uninstall any conflicting drivers that may be causing the random restart.
3. Remove Overheating Sources.
Reduce backlight on the laptop’s display.
Clean any fans or vents.
4. Run a System Diagnostics Test.
Run the system diagnostics test to identify the source of the problem.
Check the startup programs and services.