...
- Choose Apple menu > System Preferences.
- Click Security & Privacy.
- On the General tab, check "Require password ... after sleep or screen saver begins."
- Set the time period drop down to your desired amount of time.
Choose a time that's not long enough for an unauthorized person to use your computer, but not so short that if you stop working at your computer for a moment, the screen saver locks it.
...
To require a password after your computer has gone to sleep, follow the directions above for locking a screen saver on a Mac.
Tips from CNET: http://www.cnet.com/how-to/7-ways-to-lock-your-macbook/
To lock your Mac:
- Choose Apple menu > System Preferences.
- Click Desktop & Screen Saver.
- Click Screen Saver.
- Click Hot Corners...
- Set one of your corners to "Put Display to Sleep".
- Click OK.
...