A bunch of stuff has already been covered so I'll be brief and cut to the chase.
Usually those symptoms are signs of system overheating.
Think about how your laptop is set-up. It's basically a motherboard with a bunch of other intensive heat-producing hardware attached/soldered to the MoBo and all of it is encased within a slim-profiled plastic case which is your lower half of the laptop. Laptops are commonly and insufficiently cooled because they utilize a single long copper heatsink which is attached to both the CPU+GPU with crappy thermal compound in-between and is cooled off with a single small fan that vents the heat by sucking in fresh air either on top (keyboard) or the bottom of your lower half of the laptop and pushing it outward towards the side or rear.
Different computers are set to deliver a warning message when a certain temperature is reached within the setup thus triggering the BIOS to launch a fail-safe shutdown procedure to prevent further heatsoaking damage to the laptop's hardware.
Two common yet subjective remedies (YMMV) to your solution are:
Increase the fail-safe shutdown procedure's temperature target range to something higher from within the BIOS. This is an advanced user fix so I wouldn't try this unless you know exactly what you are doing. You can easily do more damage than good if you blindly mess around with the BIOS.
Buy a laptop cooler like everyone else and hope for the best. It's usually a common working remedy if utilized correctly. However, note that higher price =/= better product. Cooler Master brand coolers are great because they elevate your laptop more and are modular in a way. Best part? most coolers cost around the $20 range if you know where to look.