It was narrated that Ibn ‘Umar said:
“The Messenger of Allah (ﷺ) took hold of some part of my body and said: ‘O ‘Abdullah, be in this world like a stranger, or one who is passing through, and consider yourself as one of the people of the graves.’”
حَدَّثَنَا يَحْيَى بْنُ حَبِيبِ بْنِ عَرَبِيٍّ، حَدَّثَنَا حَمَّادُ بْنُ زَيْدٍ، عَنْ لَيْثٍ، عَنْ مُجَاهِدٍ، عَنِ ابْنِ عُمَرَ، قَالَ أَخَذَ رَسُولُ اللَّهِ ـ صلى الله عليه وسلم ـ بِبَعْضِ جَسَدِي فَقَالَ ‏ "‏ يَا عَبْدَ اللَّهِ كُنْ فِي الدُّنْيَا كَأَنَّكَ غَرِيبٌ أَوْ كَأَنَّكَ عَابِرُ سَبِيلٍ وَعُدَّ نَفْسَكَ مِنْ أَهْلِ الْقُبُورِ ‏"‏ ‏.‏
GradeDa’if (Darussalam)
English reference : Vol. 5, Book 37, Hadith 4114
Arabic reference : Book 37, Hadith 4253