Your laptop may be over heating or the battery may be faulty. Also, Check if the battery is actually charging up - its possible that the adapter may be faulty or have a broken wire in the lead, this could:
a) Cause the battery not to charge up fully or at all.
b) Cause your Laptop to simply turn off while still plugged in at the wall (providing theres no juice in the battery!)
Its could also be some sort of software error, but the most likely fault is overheating! Check that the fans work. Most laptop designs dont have the fans blowing all the time, but check that they do turn on and off!