The Messenger of Allah ﷺ said, "Whoever stands in prayer during Ramadan out of faith and seeking reward will have his past sins forgiven, and whoever stands in prayer during Laylat al-Qadr out of faith and seeking reward will have his past sins forgiven."
أخبرني محمد بن عبد الأعلى ومحمد بن هشام وأبو الأشعث واللفظ له قالوا حدثنا خالد قال حدثنا هشام عن يحيى بن أبي كثير عن أبي سلمة بن عبد الرحمن قال
أن رسول الله ﷺ قال من قام رمضان إيمانا واحتسابا غفر له ما تقدم من ذنبه ومن قام ليلة القدر إيمانا واحتسابا غفر له ما تقدم من ذنبه
Bukhari transmitted it in the Book of Fasting, chapter "Whoever fasts Ramadan out of faith, sincerity, and intention," hadith 1901, and Muslim transmitted it in the Book of the Prayer of Travelers, chapter "Encouragement to perform the night prayer of Ramadan, which is tarawih," hadith 760, from the hadith of Hisham Dastawai through this route. It is also found in Al-Kubra, hadith 2516.