The only way to confirm that the battery is still good, is to remove it and check it with a voltmeter. Or just replace it, since it's not very expensive (and commonly available). It looks like this
But before you do that, the procedure to reset SMU (power management) may fix the problem. First, reset the PRAM, if you have not already
and if that does not help, reset SMU (follow procedure precisely)
When you connect it to back to power, everything else should be disconnected. Start it up with nothing but the power cord connected, then add only a standard USB keyboard and mouse. Use it that way for a while to see if the problem still occurs. If it does not, add USB and FireWire peripherals one at a time to see if the problem comes back.