There are a few possible causes for this reaction. The first is the sensor is failing so you might want to replace it.
To alter the settings look at your Energy Saver and the Screen Saver settings in the Preferences.
You might have an app that is waking or your wake on LAN is enabled so someone is probing your system. This gets into what you've installed on your system. Sometimes you install a Peer to Peer app without knowing it! This will constantly poll your network (waking) and lastly update settings can also wake your system to install updates.