When I bought a Nexus S Android device, I read up a lot about potential issues I might face. One of the things that came up repeatedly, was the fragile nature of the power button. There were so many reports of the power button being worn out and not working within a year or two, or in some cases, even a few months of usage.
This seems to be an issue for many Samsung phones, as I read about similar issues faced by phones like the Galaxy Nexus and other newer models too. I am deeply disturbed by the fact that this issue often happens outside the warranty period, and Samsung has taken no effort to fix it even in the newer models, after being made fully aware of this.
With that in mind, I configured the phone to use the power button as less as I can. This means that the power button would last much longer for me. This same configuration can be used if you have a phone with a broken power button already. Alternatively, you can get the power button fixed, although that is not possible in many places, either due to lack of poor after sales service, expense involved or simply because the phone is not sold officially in the country.
Smart Screen On Lite can be used to turn the screen on and off using the proximity sensor located near the earpiece of your mobile phone. It has two different usage modes – you can either wave your finger above the sensor, or tap and swipe mode where you press and swipe your finger above the sensor. The latter seems more accurate. You can select the mode from app settings.
An alternative is Shake – Screen Off, an application to turn off the screen by a shake – it puts the sensors in your phone to good use. You can try the shake a few times and adjust the sensitivity from within the app, just the way you like. If you use a custom ROM on your phone, there would be settings to wake up the phone on again by pressing the volume key. Unfortunately, on stock device firmware, such options do not exist.
If your phone is rooted, an alternative is to use Button Remapper to assign one of the other soft keys as power button. In my Nexus S, I assigned the search key as power button, as I rarely used it anyway.
Use Quickboot app to restart, boot into recovery / download / bootloader mode, and switch off your phone.
My setup on the Nexus S was Button Remapper to map search key to power and volume buttons for wake (I use a custom ROM with the option built-in). This means that I do not have to mess with a separate app like Quickboot, shake the phone (which is slippery and prone to fall) or Smart Screen On Lite (swiping on proximity sensor placed up top is not convenient). However, your phone may not be rooted, and some phones do not have soft keys or extra hardware buttons that are unused – so your setup may vary from mine.
If you buy a new phone, it would be best to check for known hardware defects and act accordingly like I did – this would save a lot of trouble long term. Or better yet, buy a different phone (I insisted on the Nexus model, so I had to make do with these workarounds).