try the following
- Charge your Samsung phone to 100% battery left and turn off the device.
- Press down the “Volume-up”, “Power” and “Home” buttons to access Recovery mode.
- Use the “Volume-up” and “Volume-down” buttons to choose the “wipe data/factory reset” option.
- Again, select “wipe cache partition” using the “Volume-up” and “Volume-down” buttons.
- Tap on the “Reboot System Now” option to reboot your phone
- and then see if the phone still restarts itself.
should the above method not fix the problem then try the following
- Go to Settings on your Samsung.
- Find and click Software update/System updates.
- Tap Download and install
- After the update file is downloaded, just follow the on-screen instructions to install it on your phone.
- After restarting, check if your Samsung phone is running normally and stop turning off then on.
I hope this helps you with your problem if the problem still persists then it can only be a hardware issue and you will have to take it into a repair shop and have it looked at.
please let me know of the outcome