I have an iPhone 3GS and am running iOS5. Recently, the power/lock button stopped working. This is frustrating because it means I can never lock or turn off the phone. The phone will lock only if left idle for a few minutes. I tried doing a restore and this didn't solve the problem. Has anyone else experienced this, and is there a way to fix it?
It sounds like a hardware problem. Take it to the Apple Store and have them take a look at it. In the meantime, you can go to Settings > General > Auto-lock and change it to one minute, so that way the display will sleep after one minute of inactivity. Good luck