It is narrated from Sayyiduna Abu Sa'id al-Khudri (may Allah be pleased with him) that the Prophet (peace and blessings be upon him) said: "Whoever fasts blessed Ramadan, then knows its limits and rules and properly guards all the matters he ought to guard, this deed will become an expiation for his past sins."
Imam Abu Ya'la, Imam Ahmad bin Hanbal and Imam Ibn Hibban in his Sahih recorded it.