My iphone always restarts by itself

Solution 1:

The best thing to do is to first try a backup and restore as new as detailed in

http://support.apple.com/kb/HT4137

A lot of the time a device restarting multiple times can be caused by a software issue, and frankly getting all your data on the computer is always a a good idea.

This will also make sure you are updated to the most recent version in case you are working with old software. If it doesn't work it is probably time to get a new one or go for a repair.

Solution 2:

Since it's a 3G, it could be that your phone is just old and the battery has gone bad.

If your device is jailbroken, that could also be causing the problem.

I suggesting checking with Apple to diagnose the problem. Then, decide if its worth fixing yourself or upgrading/replacing your iPhone.