Sunan Ibn Majah, Book 5, Hadith 1387 (In-Book) ⓘ
It was narrated that Abu Hurairah said: “The Messenger of Allah said: ‘Whoever fasts Ramadan and spends its nights in prayer, out of faith and in hope of reward, his previous sins will be forgiven.’”
حَدَّثَنَا أَبُو بَكْرِ بْنُ أَبِي شَيْبَةَ، حَدَّثَنَا مُحَمَّدُ بْنُ بِشْرٍ، عَنْ مُحَمَّدِ بْنِ عَمْرٍو، عَنْ أَبِي سَلَمَةَ، عَنْ أَبِي هُرَيْرَةَ، قَالَ قَالَ رَسُولُ اللَّهِ ـ صلى الله عليه وسلم ـ " مَنْ صَامَ رَمَضَانَ وَقَامَهُ إِيمَانًا وَاحْتِسَابًا غُفِرَ لَهُ مَا تَقَدَّمَ مِنْ ذَنْبِهِ " .
also referenced under: Hadith 1326 (Reference) & Volume 2, Book 5, Hadith 1326 (DarusSalam)