Allah, exalted be His praise, says regarding the month of Ramadan: "And so that you complete the number (of days) and magnify Allah for having guided you." [Surah al-Baqarah: 185]
Imam al-Shafi'i (may Allah have mercy on him) said: I heard one of the people of knowledge of the Qur'an whom I approve of say: "That you complete the count of the fast of the month of Ramadan and magnify Allah upon its completion for having guided you; and its completion is the setting of the sun on the last day of the month of Ramadan."
Hadith Referenceالسنن الكبرى للبيهقي / كتاب صلاة العيدين / 6127