The Messenger of Allah ﷺ used to observe spiritual retreat during the last ten days of Ramadan.
حدثنا علي بن بحر حدثنا حاتم بن إسماعيل عن موسى بن عقبة عن نافع أن
قد كان رسول الله ﷺ يعتكف العشر الأواخر من رمضان
Its isnad is sahih. Hatim bin Ismail Madani, his reliability was already established at 1608, and it should be added here that Ibn Main, Ajli, and others also confirmed his reliability. Ibn Saad said in Tabaqat 5/314, "He was reliable, trustworthy, and narrated many hadiths." Bukhari gave his biography in Kabir 2/1/72.This hadith was narrated by Muslim 1/325 through Hatim bin Ismail from Musa bin Uqba, with this same isnad. It was also narrated by Bukhari 4/235, Muslim 1/325-326, and Abu Dawud 2/308-309, all three of them through Yunus from Nafi. Muslim and Abu Dawud added that Nafi said, "Abdullah showed me the place in the masjid where the Messenger of Allah ﷺ used to perform itikaf."See also 6127.