I understand that the laptop will restart after waking up from sleep mode.
Do not worry. I will try to fix the issue.
Please try these steps:
Right-Click on start button> click device manager> expand display adapters>then select the display drivers that are listed and right-click on it and uninstall the drivers.
Check the box that states delete the software for this device.Then restart the computer and update the bios chipset and graphics drivers from this link: http://hp.care/2iLrig2 Please select the correct operating system and follow the on-screen instructions.
Then perform these steps to see if it gets resolved:
Go to Control Panel, then click Power Options.
From the Select a power plan page, click Choose what the power buttons do from the list on the left panel.
On the Define power buttons and turn on password protection page, you then have the option of choosing what happens when you:
press the power button
press the sleep button
When I close the lid- select the sleep option (not shutdown or hibernate)
Now check again.
If it does not work then please perform all the prescribed steps from this link:http://hp.care/2gMk20yand follow the option “The computer does not wake up from sleep or hibernate mode”.Then check if the issue is resolved. Please disable Hybrid sleep as well.
Also from this link:https://hp.care/2Hd7BXo disable automatic restart. (Step 1: Disabling the automatic restart option to view error messages)