If the “Power” button on your iPhone isn’t working, the first thing you might want to do is take the phone apart and replace the button. Avoid doing this as taking the phone apart to do anything will invalidate the iPhone warranty. If you don’t have time to take it into your local Apple retail store or even send it off for repairs, then you need a quick, temporary fix.
Press the “Home” button on your iPhone and slide the “Unlock” bar all the way to the right to unlock your iPhone.
Press down the top, right-hand corner of the iPhone’s faceplate down with some pressure. Don’t add too much pressure, as this may cause the screen to crack, but enough pressure to where you can feel the faceplate bend a little. Pressing this part of the phone will move the button a bit so that it is able to make contact with the keys inside when you press it.
Press the “Power” button and the iPhone should lock back up. If this doesn’t work, do not apply more pressure; simply take the iPhone to be fixed as soon as you can.