Apple - My Mac isn't locking when I put it to sleep
In System Preferences > Security & Privacy > General, make sure you've checked "Require password [x seconds] after sleep or screen saver begins":
In System Preferences > Security & Privacy > General, make sure you've checked "Require password [x seconds] after sleep or screen saver begins":