You can configure Mac OS X to ask for your password each time you want to resume your Mac from standby or screensaver mode. To enable this option:
Click on the Apple
menu > System preferences
> Security & Privacy
. Go to the General
tab and tick the Require password after sleep or screen saver begins
That's it; You won't be able to wake your Mac without a valid username and password.