The Messenger of Allah ﷺ said, "Whoever fasts Ramadan and stands in prayer during it out of faith and seeking reward will have his past sins forgiven."
حدثنا أبو بكر بن أبي شيبة حدثنا محمد بن بشر عن محمد بن عمرو عن أبي سلمة
قال رسول الله ﷺ من صام رمضان وقامه إيمانا واحتسابا غفر له ما تقدم من ذنبه
[Its isnad is hasan] Tirmidhi collected it in the chapter on fasting, section on what has been narrated regarding the merit of the month of Ramadan, hadith 683, from the hadith of Muhammad bin Amr through this route.