Hadithcore
Sahih Muslim, 2651
sahih

Abu Huraira reported Allah's Messenger (ﷺ) as saying:

Verily, a man would perform the deeds of the people of Paradise for a long time, then his deeds would be concluded with the deeds of the people of Hell. And verily, a man would perform the deeds of the people of Hell for a long time, and then his deeds would be concluded with the deeds of the people of Paradise.

حَدَّثَنَا قُتَيْبَةُ بْنُ سَعِيدٍ، حَدَّثَنَا عَبْدُ الْعَزِيزِ، - يَعْنِي ابْنَ مُحَمَّدٍ - عَنِ الْعَلاَءِ، عَنْ أَبِيهِ، عَنْ أَبِي هُرَيْرَةَ، أَنَّ رَسُولَ اللَّهِ صلى الله عليه وسلم قَالَ ‏

‏ إِنَّ الرَّجُلَ لَيَعْمَلُ الزَّمَنَ الطَّوِيلَ بِعَمَلِ أَهْلِ الْجَنَّةِ ثُمَّ يُخْتَمُ لَهُ عَمَلُهُ بِعَمَلِ أَهْلِ النَّارِ وَإِنَّ الرَّجُلَ لَيَعْمَلُ الزَّمَنَ الطَّوِيلَ بِعَمَلِ أَهْلِ النَّارِ ثُمَّ يُخْتَمُ لَهُ عَمَلُهُ بِعَمَلِ أَهْلِ الْجَنَّةِ ‏

‏ ‏.‏

References2 variants
In-Book Reference
Book 46, Hadith 18
USC-MSA web (English) reference
Book 33, Hadith 6407 (deprecated numbering scheme)