Sahih Muslim , Book 4, Hadith 1663 (USC-MSA)

Abu Huraira reported: The Messenger of Allah used to exhort (his Companions) to pray (at night) during Ramadan without commanding them to observe it as an obligatory act, and say: He who observed the night prayer in Ramadan because of faith and seeking his reward (from Allah), all his previous sins would be forgiven. When Allah's Messenger died, this was the practice, and it continued thus during Abu Bakr's caliphate and the early part of 'Umar's caliphate.

وَحَدَّثَنَا عَبْدُ بْنُ حُمَيْدٍ، أَخْبَرَنَا عَبْدُ الرَّزَّاقِ، أَخْبَرَنَا مَعْمَرٌ، عَنِ الزُّهْرِيِّ، عَنْ أَبِي سَلَمَةَ، عَنْ أَبِي هُرَيْرَةَ، قَالَ كَانَ رَسُولُ اللَّهِ صلى الله عليه وسلم يُرَغِّبُ فِي قِيَامِ رَمَضَانَ مِنْ غَيْرِ أَنْ يَأْمُرَهُمْ فِيهِ بِعَزِيمَةٍ فَيَقُولُ ‏ "‏ مَنْ قَامَ رَمَضَانَ إِيمَانًا وَاحْتِسَابًا غُفِرَ لَهُ مَا تَقَدَّمَ مِنْ ذَنْبِهِ ‏" ‏ ‏.‏ فَتُوُفِّيَ رَسُولُ اللَّهِ صلى الله عليه وسلم وَالأَمْرُ عَلَى ذَلِكَ ثُمَّ كَانَ الأَمْرُ عَلَى ذَلِكَ فِي خِلاَفَةِ أَبِي بَكْرٍ وَصَدْرًا مِنْ خِلاَفَةِ عُمَرَ عَلَى ذَلِكَ ‏.‏

sunnah.com