I’m a battery researcher and most of the points on this thread are correct. I just want to get my 2 cents in.
Not all solutions work for all batteries as they use different chemistries even though they are all Lithium-ion.
There are three main ways batteries degrade: 1) Cycling 2) Calendar aging 3) High temperature. And these rates are different for different batteries.
- Cycling: Charging your battery and discharging. As mentioned earlier in the thread by @freebird54, you want to keep them between 20-80% for the longest battery life. This is because batteries degrade more at higher and lower SOCs (state of charge). Even better is if you can disable quick charge. Batteries degrade faster when charging at higher currents (which is what quick charge is).
- Calendar aging: This happens when you are storing the battery i.e. not using it. Again the same principle. Avoid lower and higher SOCs. For example, if you always keep your laptop plugged in, a SOC of 50% is ideal. You can push it to 80% if you need more capacity when on battery. This is the reason why in many manuals it is recommended that when removing your battery for storage you do so at 50%.
- Battery Temperature: As my advisor says, batteries are like humans in the sense that they are comfortable in temperature ranges humans are comfortable in. Avoid low temperatures and high temperatures. As @anon31549144 mentioned above, undervolting to keep the CPU cool is a good place to start to keep temperatures low. Also using a cooling pad, cleaning the vents on your laptop, using laptops on flat surfaces which allow decent airflow to keep temperatures low is recommended.
These are just general principles most Lithium-ion batteries will follow. Results might vary based on battery chemistry. Batteries are getting better with regards to life so newer batteries using newer technology might last longer.
Hope this is helpful. Please message me if you have any questions or want clarifications.
edit: As suggested by @anon49550872 it is recommended to do a full charge-discharge, once a month or so (more frequently or less frequently is also fine). What this does is calibrate the battery capacity so the SOC what you see on your screen i.e. the charge % is accurate.