Original post by: Brian Wood ,
In my experience, it's 1 of 2 things. 1. I have seen bad batteries cause this, because they can't supply the proper amount of power consistently. I would replace the battery. Here is the iFixit guide [guide|29424]. 2. It could be a bad NAND flash (your iPhone's hard drive). There are services out there to reflow the NAND chip, however I have never used them. I have had the exact issue you explained and 9 times out of 10 it's one of these two. Hopefully for your sake, it's number 1. Let me know, if you have any other questions.