Definitely a defective unit. Bring it to apple and it should be replaced. Given how often it is restarting it shouldn't be hard for apple to see the issue. My GF had this issue with her 3gs a few years back and it was resolved easily. Don't know if it was a problem with the battery connection or what. But it was an easy fix, in and out of the apple store in less than 20 minutes.
Also, apple tends to keep some iPhones set aside specifically for warranty claims.