Your computer has a temperature sensor that runs the fan faster when it senses its CPU chip is getting too warm. If the increased fan speed doesn't keep the temperature from reaching a preset maximum, then the computer will turn itself off to prevent damage. The symptoms you describe match this scenario exactly.
There could be a couple reasons it's overheating:
1. You might be blocking the vents when you set it on your lap. (Try placing it on something flat like a cutting board.)
2. The fan might be clogged with dust, or maybe if you're lucky just the vent holes for it.
These are the most likely. But possibly you need to replace the fan.