Sahih al-Bukhari 2044
Sahih al-Bukhari · Book 33: Retiring to a Mosque for Remembrance of Allah (I'tikaf) · I'tikaf in the middle ten days of Ramadan
Narrated Abu Huraira:
حَدَّثَنَا عَبْدُ اللَّهِ بْنُ أَبِي شَيْبَةَ ، حَدَّثَنَا أَبُو بَكْرٍ ، عَنْ أَبِي حَصِينٍ ، عَنْ أَبِي صَالِحٍ ، عَنْ أَبِي هُرَيْرَةَ ـ رضى الله عنه ـ قَالَ كَانَ النَّبِيُّ صلى الله عليه وسلم يَعْتَكِفُ فِي كُلِّ رَمَضَانَ عَشْرَةَ أَيَّامٍ، فَلَمَّا كَانَ الْعَامُ الَّذِي قُبِضَ فِيهِ اعْتَكَفَ عِشْرِينَ يَوْمًا.
The Prophet (ﷺ) used to perform I`tikaf every year in the month of Ramadan for ten days, and when it was the year of his death, he stayed in I`tikaf for twenty days.