As laptop batteries age, they get worse at storing charge and their capacity gradually decreases. There are a few techniques that you can use to prolong their useful lifetime, although you shouldn't expect a big difference.
Don't let the battery run all the way down. Always recharge before the battery gets very low; recharging when it is only partially discharged is more efficient.
Heat has a detrimental effect on a battery's charging efficiency. Don't let the battery get any warmer than it has to.
Batteries age even if you leave them in storage. There is little advantage in buying a replacement battery at the same time as you get the original battery - always buy replacements when you need them.
This advice applies specifically to Lithium-Ion (Li-Ion) batteries, which are the most common type. Other types of battery may behave differently.