All laptops shut down when they overheat. This is done to avoid permanent damage, etc, etc.
To prevent it from further overheats in the future, I'd recommend using a can of compressed air to blow out each of the vents that your computer uses as cooling. If you want to, you can actually disassemble the entire laptop and do a thorough cleaning of the likely very dirty fan.
On the software side of things, check your Task Manager when the computer is on. Take note of any processes that use excessive amounts of CPU time or consume large amounts of RAM. You may be able to uninstall the programs that do that.