Right-click on regedit icon, click Run as administrator.You have to enable this option in registry before being able to change it. On my machine it was set to 2 minutes, which was mighty annoying, as it would cause behavior described by OP (sleep, wake-up, login screen, Event Viewer saying: 'The system is entering sleep Sleep Reason: System Idle'). This is most likely happening due to a hidden power option called System unattended sleep timeout.