My iPhone turns itself off for no reason?

A couple of weeks ago I noticed my iPhone 4s turning off for no reason at random times. It's only when I lock the screen I can leave it for a few seconds or a few minutes but I go to wake it up again and press 1 of the buttons and the screen is just black. Sometimes just pressing the home button makes it turn back on sometimes I have to power it back on like normal and sometimes it won't turn on unless I hold the on button and the home button at the same time. It doesn't happen all the time just occasionally and at random times. Any ideas

Have you tryed charing it or just leaving it for an hour or two?

Why does my phone turn off when I'm talking to someone?

Why does my phone turn off when I'm talking to someone?