If you have Windows Update configured to automatically download and install updates, and one or more requires a restart, it will install the updates and reboot itself. If you don’t want your computer restarting itself occasionally, you can stop the auto reboots with this registry hack.
Hive: HKEY_LOCAL_MACHINE
Key: SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU
Value Name: NoAutoRebootWithLoggedOnUsers
DWORD Value: 0 = no effect, 1 = do not automatically reboot