As noted above, you must advise Where you are noting that it is NOT Charging.. Does the 'wee light on your MagSafe' just go out, or does the Computer actually SAY that it is No Longer Charging as well..??
** The Symbol on your computer should change from an Battery with A.C. Cable End to a Blacked Out % indicator) **
** You can do a simple troubleshooting test to see if it is the Charger 'from the wall adapter to the MagSafe' by holding the connector at your computer in place firmly and moving the cable about with your other hand (or another person) to see if you have an Intermittent Power Problem.. If the charging DOES NOT seem to stop during this, then it may well be the MagSafe connector..
If it is found to be a problem at the MagSafe, then YES to cleaning it and the Computer Connector, especially if it appears dirty as well..
If the connection seems solid and the Computer indicates the charging has halted, then perhaps your charger has given up, and/ or hopefully NOT an Internal issue..