In the OS X Security system preferences you can set the system to require a password when the system wakes from sleep or after the screensaver has been active for a period of time. However, you may run into a few cases in which entering your account password then does not work.
One cause can be if you have recently changed the name of your user account. For authentication, OS X will use either the short or long username,that you have associated with your account. However, if you have changed the long username for your account and have not yet restarted or completely logged out and back in, then the system may still have your old account name loaded for quicker authentication. In this situation, if you are prompted to authenticate then the old, now incorrect, username will be presented at the password prompt.
This is usually not an issue since the username in authentication prompts is generally editable. However, the screensaver and sleep password prompts in OS X Lion and later display the username as static text above the password field so it's not obvious how to edit it. In fact, you can still edit the username by pressing Option-Enter at the prompt.
Try changing it to either the new long username for your account or the short username, or alternatively you can supply the username of any admin user account and get by the password prompt that way.
Once past the authentication screen, you can then restart your system so it will properly load and use your new credentials, or you can investigate your account's credentials in the Users & Groups system preferences to see if any typos or other mishaps could have resulted in the problem.