Were the circumstances the same all three times?
It is possible that the phone is reaching a temperature above the recommended operating temp. When this happens the phone will shut itself off to avoid damage to the internal components.
If the circumstances of three shutdowns are different then it is possible that the issue is either software or hardware. To determine whether the issue is hardware related you would want to put a fresh set of system software on the phone to rule out any software glitches. This would remove your data from the phone so be sure to sync before you Restore the phone in iTunes.
More info on backing up and restoring your phone can be found here:
If after restoring the phone your issue is still present, it's pretty safe to say your issue is hardware related.
Hope this is helpful!