If it's the original battery it could be that. Batteries die - how long they last depends upon how they are used/abused. If the laptop has been squeezed or had items stacked on it the battery could be cracked. Over 3 years can be a long time (like "dog years") for a battery,
While it's plugged in use System Profiler, or, System Inforation: Power to find out how many cycles are on the battery and if it's charging. High cycles and failure to charge indicate need for battery replacement. Batteries have onboard chips that report if they are "good" or "bad".
Be careful of the sudden shutdowns. Keep important data backed up - repeated crashing of the system can screw up the MDB of a HD so that it will no longer work. You should not let this go - find a solution ASAP.
If this answer is acceptable please remember to return and mark it.