When your experience your PC or laptop going into sleep mode randomly there a lot of things that could cause that. What resolved the issue for me is this:
# Open command prompt as administrator and run the following command:
REG ADD "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Power\PowerSettings\238C9FA8-0AAD-41ED-83F4-97BE242C8F20\7bc4a2f9-d8fc-4469-b07b-33eb785aaca0" /v Attributes /t REG_DWORD /d 2 /f
# Restart the ‘explorer.exe’ process via task manager.
# Go to your energy settings and edit the power plan you are currently using. Choose ‘change advance power settings’ and go to the sleep section.
Expand the ‘System unattended sleep timeout’ and change the 2 minutes to 0, or whatever.