Be sure to inspect the metal connectors to see if they're stuck or fail
to have both halves fit correctly; sometimes the metal part gets stuff
in there that may not easily be removed with a dry brush.
Learn about using the Apple MagSafe Adapter included with your Mac
notebook computer and get tips for reducing wear on the adapter.
//support.apple.com/en-us/HT202451
Be sure to regularly inspect and clean both the MagSafe adapter connector
and the power port on your Apple portable computer for dirt or signs of damage.
//support.apple.com/en-us/HT203207
• Reduce cable strain on your MagSafe power adapter - Apple Support
//support.apple.com/en-us/HT201600
There are a suggestions in iFixit.com repair guide DIY damaged MagSafeadapters.
Another thing, if internal Mag connector inside the Mac is bad: it can be replaced.
Part is known as 'MagSafe DC-in Board' is separate logic board. ~ Level: Difficult.
• MacBook Pro 13" Unibody Mid 2009 'DC-in Board' Replacement - iFixit
Good luck & happy computing! 🙂