The New York Times recently tackled this question: should you charge your phone overnight? The answer was if you’re only keeping your phone for two years and then replacing it as most people do, go ahead, it makes no difference.
The heart of the question has to do with the amount of charge/discharge cycles a smartphone battery can go through. In the article they say that overnight charging in itself is not a problem because smartphones have a chip that stops the phone from absorbing any extra electrical current once the battery is fully charged. You can’t “overcharge” the battery.
The issue with charging every night is that the daily charging and discharging of the battery eventually wears down the battery and leads to a reduction in the amount of charge it can hold, so you’ll find yourself reaching for your charger even more often. That slimming down of battery capacity usually happens in about two years and that frustration is what often causes a person to upgrade to a new phone.
The solution is charging your battery less, which means using your phone less — not going to happen — or finding a way to charge your phone more slowly so that there is less stress on the battery over time.
The chargers used with current smartphones optimize the speed of the charge, but that also hastens the corrosion of the battery. You can try using a charger that typically charges a less powerful device, but it may be tricky to find the right match. For instance, you could use your iPhone charger to slowly charge an iPad Pro.
Another important tip is to avoid temperatures over 95 degrees. Exposure to high temperature also damages the battery and shortens its life.
The best thing you can do though is protect your phone, charge it when necessary and then when the battery capacity dives, replace the battery, not the whole phone. You can buy a replacement battery for between $20 and $40 and iFixit.com has step-by-step guides for replacing it on your own. Many Android phones have a removable cover where the battery can easily by swapped out.