If you notice your phone battery capacity dropping after a year or two of use: that’s normal, because rechargeable batteries slowly lose capacity over time. Charging your phone while you sleep is also a bad habit to adopt, especially if you’re partially charging your phone’s battery between 20 to 80 percent, as Make Use Of details:
Manufacturers specify the life expectancy of smartphones through "battery charge cycles." A charge cycle is defined as charging the battery from 0 to 100 percent and then discharged back down to 0 percent. The number of expected charge cycles will tell you how many full cycles the battery can handle before it noticeably starts to lose capacity.
Avoid extremes to extend your battery life. Partial charges and discharges that combine to 100 percent count as a single full cycle. By partially charging and discharging between 20 and 80 percent, you could get 1,000 full cycles or more before hitting a noticeable drop in capacity. That's almost three years of daily charges.
Why does this happen? It's due to how your battery actually works. These batteries are made of a lithium cobalt oxide layer and a graphite layer. Lithium ions move from the graphite to the lithium cobalt oxide to release energy. Charging your battery moves those ions back to the graphite layer.
That's why either extreme damages the battery: you're compromising the cell's integrity because over-stuffing a layer with Lithium increases internal resistance.
Image via Make Use Of