You can keep your MacBook Pro plugged in overnight as long as it is in good working condition. If your battery has any damage, indicated by extreme heat or swelling, then leaving the computer plugged in overnight is not a good idea. The most important factor in maintaining battery health is to vary your usage, occasionally running the charge all the way down and alternating use on AC and battery power.
Charging MacBook Pro Laptops
Modern MacBook Pro models charge quickly until the battery is at 80 percent of its capacity, and then the charging slows so the battery receives only a trickle of electricity for the last 20 percent. This gives you a quick charge for immediate use, while also letting you leave the computer plugged in for extended periods, such as overnight, without damaging the battery or wearing it out by overcharging.
An overnight charge will not hurt your MacBook, but if you normally operate it with the power cord plugged in, your battery may lose the ability to last as long as it should per charge. In this case, operate the computer on battery power until it runs all the way down at least once per month and then charge it back up to full capacity before your next battery use.
If leaving your MacBook plugged in overnight, place it in sleep mode or turn it off, unless you need it on for a specific reason, such as a large download you are running overnight. Placing the MacBook in sleep mode or powering it off reduces the risk of overheating due to processor activity during the night. Always place the computer on a sturdy, flat surface that allows ventilation beneath the computer and at the back, as well as on all sides of the power adapter, if you're running it overnight on AC power.
If your MacBook Pro becomes unusually hot after you leave it plugged in overnight, unplug it and let it cool down, then take it to a certified Apple repair specialist. This is usually not a problem with modern MacBooks, but older MacBook batteries can degrade over time, and the lengthy charge can create unwanted heat. If your MacBook has a removable battery, as do most pre-2009 models, you can replace the battery yourself for safer overnight charging.