Why does OS X automatically logout my user?

Solution 1:

I had the same issue but it was because "Logout after 60 minutes of inactivity" checkbox was enabled.

Solution 2:

I've experienced a similar issue. My MacBook Pro was actually rebooting itself during the night, so in the morning, I found it displaying the login screen instead of where I left it in the afternoon (converting a TV recording from my DVR).

You can check when your MacBook was rebooted the last time. To do so, open Terminal.app and enter

uptime

The command will output something like this:

 9:44  up 1 day, 14:19, 1 user, load averages: 0.38 0.29 0.32

This displays the current time (9:44) and how long ago the machine was rebooted the last time (1 day, 14 hours, and 19 minutes ago).

This won't exactly solve your problem but help you to find or eliminate a particular root cause (the reboot).