Your iPhone's Sleep/Wake button, located on the top right-hand corner of the outer rim of your phone, offers a variety of functions, the most important of which makes your phone "sleep" to save battery and stop interactions, or "wake" to restore functionality. If your iPhone's Wake/Sleep button isn't functioning properly, restart your iPhone before you consider a replacement.
When you put your phone to sleep, you deactivate the touch screen to avoid unwanted commands and calls. If you have a lock on your iPhone, it also activates your key code so only you can access your phone. Pressing the button when your iPhone is in sleep mode activates the open screen to access your phone. The Sleep/Wake button is also important for resetting your iPhone. If your phone becomes so frozen that you cannot shut it down properly, holding the Sleep/Wake button and the Home button simultaneously restarts your iPhone.
If your Wake/Sleep button doesn't seem to be working properly, try some of the other functions on your iPhone to ensure the problem is isolated to the button hardware and doesn't affect your iPhone's software. As long as your iPhone seems to be responsive, your button issues could be related to hardware; if your entire iPhone is frozen, your software has likely malfunctioned. In both cases, restarting your iPhone could restore functionality.
Restarting Your iPhone
Apple suggests restarting your iPhone to restore functionality to your hardware and buttons. To restart your iPhone, press the "Sleep/Wake" button and the "Home" button simultaneously for about 10 seconds. Your iPhone displays the slider bar for shutdown and automatically shuts down. Press the "Sleep/Wake" button until the Apple icon appears. If the buttons are so unresponsive that you cannot restart your iPhone, it probably needs service.
Service and Warranty
Your Apple iPhone is protected by a one-year warranty that insures your device against hardware and software malfunctions that are not the result of your usage. Unless the iPhone shows signs of abuse, such as an activated water contact indicator or cracks and scratches from being dropped, you should be able to obtain service or a new device for free. After a year, you are responsible for paying for service and replacement devices.