Hi Elizabeth,
Welcome to Apple Support Communities.
It sounds like there is an issue with the Sleep/Wake button on your iPhone. If you're using a case with the iPhone, test the button without the case to rule it out as a possible cause of the issue. If you aren't using a case with the iPhone or you believe the issue isn't caused by the case, try the suggestions in the article below.
iPhone: Hardware troubleshooting
http://support.apple.com/kb/TS2802
Sleep/Wake button won't lock or unlock iPhone
- To lock the phone, press the Sleep/Wake button. Note: By default, if you don't touch the screen for a minute, iPhone locks automatically.
- To unlock iPhone, press the Home button or the Sleep/Wake button, then slide the slider.
- If either of the above steps don't work, try turning iPhone off and then on again.
- If the iPhone will not power off, reset it.
- Try to lock or unlock the phone.
Issue not resolved
My issue is still not resolved. What do I do next?
Contact Apple Support.
I hope this helps.
-Jason