Somtimes a magic pocket fairy hits the "ok" button to unlock the phone when you haven't asked it to...haha. Mine does that all the time.
You can set your phone to require a password to unlock, by going to menu>settings & tools>phone settings>security. You will be prompted to enter your "phone lock code." (should be the last four digits of your phone number.) You can change your "phone lock" to lock on "power up," or choose "lock phone now" before you put it in your pocket, which will defend against pocket fairy attacks.
