To resolve this completely will take quite a lot of detective work to find the cause. To start, try Control panel - Adninistrative tools - Event viewer. Look in both Application and System to see if there are any errors that coincide with the time of the rebooting. As a temporary fix also try Control panel - System, click the "Advanced" tab, go to bottom and under "Startup and recovery" click "Settings" then untick "Automatic restart". When your computer next encounters the cause of the problem, if it's not hardware related it may hang but shouldn't switch off.