The Messenger of Allah ﷺ used to observe seclusion during the last ten days of Ramadan.Nafi said, "Abdullah bin Umar showed me the place where the Messenger of Allah ﷺ used to seclude himself."
حدثنا أحمد بن عمرو بن السرح حدثنا عبد الله بن وهب أنبأنا يونس أن نافعا حدثه
أن رسول الله ﷺ كان يعتكف العشر الأواخر من رمضان قال نافع وقد أراني عبد الله بن عمر المكان الذي كان يعتكف فيه رسول الله ﷺ
Bukhari narrated it, itikaf, chapter on itikaf during the last ten nights, hadith no. 2025, from the hadith of Ibn Wahb through this route, and Muslim, itikaf, chapter on itikaf during the last ten nights of Ramadan, hadith no. 1171, from Abu Tahir Ahmad bin Amr through this route.