Putting your PC to sleep is an extremely effective way of finishing a session while keeping all your active windows open. 

It means you can instantly pick back up where you left of, without your device using unnecessary power and generating heat when it's not needed. 

Unfortunately, some Windows devices have an annoying recent habit of automatically turning off sleep mode, negating many of the benefits listed above. 

Here's how to find out what's causing the issue, and hopefully fix it.

Identify what's causing your PC to wake from sleep: Command Prompt

Before you go about tackling the problem, it's worth figuring out what caused the issue in the first place. 

This might not be obvious, but there is some software built in to Windows 10 that can help. 

One such example is via the Command Prompt window, accessible through a quick search in the Start Menu. 

From here, enter the command 'powercfg –lastwake' and hit enter. This will now show you the last device that woke your PC from sleep. 

If you see a message saying 'Wake History Count - 0' or 'NONE' it means Windows has no records of being woken from sleep, although this figure is reset if your PC is rebooted. 

In that scenario, it's worth checking all the devices that have permission to wake your PC automatically. In the same window, enter 'powercfg –devicequery wake_armed' and hit enter. 

You will now see a list of devices that are able to wake your PC from sleep, which should include the keyboard and mouse. There's no dedicated setting if you want to remove one of the other devices, so you'll have to enter another command: 

'powercfg -devicedisablewake [DEVICE NAME]'

In this example, replace 'DEVICE NAME' with the name of the device exactly as you saw it in the previous step. 

Identify what's causing your PC to wake from sleep: Event Viewer

If you want more information than just the name of the device causing a wake up, head to event viewer. The easiest way to access this is by typing 'Event Viewer' in the search bar on the taskbar and clicking the first option. 

In the window that appears, left-click 'Windows Logs', then right-click 'System' and choose 'Filter Current Log' from the left pane. 

There are plenty of ways to filter the results here, but you'll want to choose 'Power-Troubleshooter' from the 'Event sources' drop-down. You can also choose a specific time frame from the 'Logged' drop-down, before hitting OK to confirm. 

You'll now see a list of all the events that match your criteria, so any time when your PC woke or went to sleep should be recorded.

Clicking on one will provide more information about it, and the key thing you're looking for is 'Wake Source' within the main box.

If the time matches when you think your PC might have turned back on, you've probably found the offending party. 

How to stop your PC from waking from sleep

Once you've identified the problem, here are four key ways you can stop it from happening again:

Disable wake-ups in Device Manager

If you've found a specific app causing the wake-ups, the most effective way to solve the problem is via the Device Manager:

  1. Right-click the Start Menu icon and choose 'Device Manager'
  2. From here, you'll see a list of all the devices that can communicate with your PC. Expand each category to find relevant devices
  3. Locate the device revealed by the above diagnostics and double-click it to open the 'Properties' window
  4. Select the 'Power management' tab and uncheck the box next to 'Allow this device to wake the computer'

Turn off Wake-on-LAN

Wake-on-LAN can be hugely beneficial, allowing your device to be turned on remotely. However, in the event of a malfunction it could be the cause of your issue. Here's how to turn it off:

  • While still in Device Manager, look for a device containing the word 'Ethernet' in the 'Network adapters' section (the feature is usually associated with wired connections)
  • Double-click it and head to the 'Power management' tab as before, and ensure all the boxes under 'Wake up on LAN' are unchecked

Change task scheduler

Many tasks that are scheduled to run in the background may require the device to wake in order to run. Here's how to turn them off, although you'll need to make sure they're performed at some point:

  1. Head to Settings > System > Power & sleep
  2. Click 'Additional power settings' in the right pane, which will open the Control Panel
  3. Click 'Change plan settings' next to your current plan and then 'Change advanced power settings'
  4. Expand the 'Sleep' section and then 'Allow wake timers'
  5. Under both 'On battery' and 'Plugged in', ensure timers are set to 'Disable'

Turn off scheduled maintenance

Scheduling maintenance for when you're not using your PC is great, until it starts waking up the device when you're not using it. Here's how to turn it off:

  1. Open Control Panel from the Start Menu. Ensure you're in the 'small icon' view, so click 'Category' if you see it in the top right of the window
  2. Head to Security and Maintenance and click the Maintenance drop down
  3. Under 'Automatic Maintenance', click 'Change Maintenance settings'
  4. Make sure the box next to 'Allow scheduled maintenance to wake up my computer at the scheduled time' is disabled

However, this does mean you'll have to manually perform maintenance operations in your own time. Neglecting these altogether could significantly harm the stability of your PC. 

If none of these solutions work, it's worth checking if there's any malware causing spontaneous wake ups. 

The built-in Windows Defender will do a good job, while the free Malwarebytes is an excellent alternative.