Hadithcore
Sunan Ibn Majah, 2704
hasan· Darussalam

It was narrated from Abu Hurairah that the Messenger of Allah (ﷺ) said:

“A man may do the deeds of the people of goodness for seventy years, then when he makes his will, he is unjust in his will, so he ends (his life) with evil deeds and enters Hell. And a man may do the people of evil for seventy years, then he is just in his will, so he ends (his life) with good deeds and enters Paradise.”Abu Hurairah said: “Recite, if you wish: “These are the limits (set by) Allah (STW) up to His saying: 'a disgraceful torment'”

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

‏ إِنَّ الرَّجُلَ لَيَعْمَلُ بِعَمَلِ أَهْلِ الْخَيْرِ سَبْعِينَ سَنَةً فَإِذَا أَوْصَى حَافَ فِي وَصِيَّتِهِ فَيُخْتَمُ لَهُ بِشَرِّ عَمَلِهِ فَيَدْخُلُ النَّارَ وَإِنَّ الرَّجُلَ لَيَعْمَلُ بِعَمَلِ أَهْلِ الشَّرِّ سَبْعِينَ سَنَةً فَيَعْدِلُ فِي وَصِيَّتِهِ فَيُخْتَمُ لَهُ بِخَيْرِ عَمَلِهِ فَيَدْخُلُ الْجَنَّةَ ‏

‏ ‏.‏ قَالَ أَبُو هُرَيْرَةَ وَاقْرَءُوا إِنْ شِئْتُمْ ‏{تِلْكَ حُدُودُ اللَّهِ}‏ إِلَى قَوْلِهِ {عَذَابٌ مُهِينٌ}‏

References2 variants
In-Book Reference
Book 22, Hadith 10
English Reference
Vol. 3, Book 22, Hadith 2704