When a battery is connected to an AC source, the electrodes erode as the electric current is passed through the contacts and through the battery in a process called as 'electroplating'. The deposits on the anode and cathode in turn gradually but certainly, increase the internal resistance of the unit. This causes a voltage drop
across the polar caps of the cells as the amperage drawn by our computers remain the same. As this happens continuously over time, the run-time of the battery lowers from 88,000 mh useable (3 hrs) to about 14,000 (35 mins) over a period of 2-3 years.
Li-Ion batteries usually have an efficient age limit of 2-3 years depending on the usage. To best avoid this run-away electro-erosion, I would highly recommend to use your laptop batteries in a constant charging and discharging cycles per use. Li-ion batteries should be charged typically to 100% and discharged to utpo, if not less than 12-15%.
Lot of other tips are available online, but I found most of them redundant and producing negligible results. However, this method has been tried and tested by me over a period of over 6 years. Using this method of charging and discharging, my battery backup time remained in the efficient bracket of upto 3 hrs when new, to 1:10 mins after 3 years.
:-)