The Messenger of Allah [SAW] said: "Whoever stands (in the voluntary night prayer of) Ramadan out of faith and in the hope of reward, his previous sins will be forgiven. And whoever spends the night of Lailat Al-Qadr in prayer out of faith and in the hope of reward, his previous sins will be forgiven."
أَنَّ رَسُولَ اللَّهِ ﷺ قَالَ مَنْ قَامَ رَمَضَانَ إِيمَانًا وَاحْتِسَابًا غُفِرَ لَهُ مَا تَقَدَّمَ مِنْ ذَنْبِهِ وَمَنْ قَامَ لَيْلَةَ الْقَدْرِ إِيمَانًا وَاحْتِسَابًا غُفِرَ لَهُ مَا تَقَدَّمَ مِنْ ذَنْبِهِ