Right click on My Computer and select properties.
Click Advanced tab.
Click Settings under Startup and Recovery.
Under System Failure uncheck Automatically Restart.
Click OK.
This won't cure your problem, as instead of restarting you'll likely get a Blue Screen of Death (BSOD) instead, but the information displayed will allow you to trace your problem, or post it here!
If you still get the system rebooting and there is no BSOD then it's likely that your processor is overheating or your PSU is faulty.