IPhone 5s keeps turning itself off and on when I wake/sleep the device?

This just started today, but each time I wake my iPhone it goes through a process of trying to turn itself off, me pressing cancel, the screen turning off, and then it turning back on seconds later and then it's completely fine. The process happens all over again when I make my phone sleep again. It only happens when I press the power button but I've read that it might be something else. Any suggestions?

Try resetting your phone. If it is a software problem, it will be fixed.
If the problem still exists, you can confirm it as a hardware problem.

  • Why won't iphone sleep/wake button work? It worked completely fine yesterday and now it won't.haven't dropped it and it hasn't given me a problem before.
  • Siri keeps turning itself off in settings? I installed Siri on my jailbroken iPhone 4 with siridr but whenever I turn on Siri in settings and I go back to it it's off. I'm losing my mind! I can still boot up Siri but it just keeps loading after I say something until I turn it off. Any help is greatly appreciated
  • My iPhone keeps turning on and off like it turns on and off. Can someone tell me? Okay tbms it turns on and off on and off and then sometimes it shows a red screen for a few seconds then off again and dies out. It's not the battery because I got that changed thinking that it was the cause and it wasn't. So is there anything someone can help me with? The repair guy tried restoring it through iTunes he said it didn't work either it just won't come on it doesn't go pass the Apple logo before shutting off and on again and dying out
  • My iphone keeps turning itself off and won't turn back on again? I have an iphone 4s, i've had it for a year now.recently it will randomly turn itself off even when it has charge in it, it will go off and not turn on for hours. I keep trying to turn it on and eventually it will come up with bit saying it needs to be charged basically.sometimes the screen will go blue or come up with random colours and turn off. I have no insurance for it either. I ordered it online, it's a contract with 3 mobile.i'm not sure if warranty as run out.