Check the event log for issue when it shut down. If windows shut it down it would log an event.
If it automatically reboots on you, press f8 during boot up and you should see an option to disable automatic rebooting on errors. This will allow you to see the error message.
If it just switches off like someone yanked the plug, then you will need to test the power supply.
It could be a temperature issue but usually alarms begin going off once you go into the danger zone and before the system would shutdown. These temps are set in the bios. Typically you would get a message that the system was shutdown due to a thermal event when you boot it back up.