your computer may be experiencing some overheating due to dust buildup. Can you open the side of the case and inspect the fan(s), air intake vents (front, back and sometimes side) and the processor's heatsink?
A few pictures of heatsinks in the following links.http://www.google.co...l=en&q=heatsinkhttp://en.wikipedia.org/wiki/Heat_sink
The heatsink fins will often become compacted with dust, and the fan blades will aquire buildup as well, all of which prevents good air flow and resulting cooling of the processor. The power supply (where the power cord plugs into the back of the computer) also has a fan and air flow vents, both of which can become clogged with dust. Overheating of either or both the power supply and processor can cause the computer to shutdown as you've described.
The best way to remove the dust buildup is with compressed air, which is available in cans from most any general merchandise store, office supply store and electronics store if you don't have access to an air compressor. When using compressed air to clean, don't allow the air flow to spin the fan blades. Hold the ones you can and use a toothpick or similar to hold the ones you can't get to, like the power supply fan (back of the machine).
Do NOT use a vacuum cleaner to remove dust. It can create static electricity which might arc to your computer's components thereby damaging it.