Why does my iphone 4 keep turning off?

I have had my iphone about 1 year and a bit
And recently it has started doing this thing of turning itself off automatically, it then turns itself back on within about 5 seconds (i don't have to press anything)
Is this a serious hardware issue?

Restore to the latest firmware, if it didn't fix it it's probably from the hardware so you gotta take it to the apple store they will fix it or replace it with a newer one!