كتاب الحج
15  
The Book of Pilgrimage
(68)
Chapter: It is recommended for pilgrims and others to enter the Ka'bah and pray therein, and supplicate in all its corners
(68)
باب اسْتِحْبَابِ دُخُولِ الْكَعْبَةِ لِلْحَاجِّ وَغَيْرِهِ وَالصَّلاَةِ فِيهَا وَالدُّعَاءِ فِي نَوَاحِيهَا كُلِّهَا
Sahih Muslim 1329 d

Ibn 'Umar (Allah be pleased with them) reported:

Allah's Messenger, (ﷺ) entered the House, and Usama, Bilal and Uthman b. Talha were with him, and they kept the door closed for a considerable time. Then it was opened and I was the first to enter the House and meet Bilal, and I said: Where did Allah's Messenger (ﷺ) observe prayer? He said: Between these two front pillars. I, however, forgot to ask him the number of rak'ahs that he observed.
وَحَدَّثَنِي زُهَيْرُ بْنُ حَرْبٍ، حَدَّثَنَا يَحْيَى، وَهُوَ الْقَطَّانُ ح وَحَدَّثَنَا أَبُو بَكْرِ بْنُ أَبِي، شَيْبَةَ حَدَّثَنَا أَبُو أُسَامَةَ، ح وَحَدَّثَنَا ابْنُ نُمَيْرٍ، - وَاللَّفْظُ لَهُ - حَدَّثَنَا عَبْدَةُ، عَنْ عُبَيْدِ اللَّهِ، عَنْ نَافِعٍ، عَنِ ابْنِ عُمَرَ، قَالَ دَخَلَ رَسُولُ اللَّهِ صلى الله عليه وسلم الْبَيْتَ وَمَعَهُ أُسَامَةُ وَبِلاَلٌ وَعُثْمَانُ بْنُ طَلْحَةَ فَأَجَافُوا عَلَيْهِمُ الْبَابَ طَوِيلاً ثُمَّ فُتِحَ فَكُنْتُ أَوَّلَ مَنْ دَخَلَ فَلَقِيتُ بِلاَلاً فَقُلْتُ أَيْنَ صَلَّى رَسُولُ اللَّهِ صلى الله عليه وسلم فَقَالَ بَيْنَ الْعَمُودَيْنِ الْمُقَدَّمَيْنِ ‏.‏ فَنَسِيتُ أَنْ أَسْأَلَهُ كَمْ صَلَّى رَسُولُ اللَّهِ صلى الله عليه وسلم.
Reference : Sahih Muslim 1329d
In-book reference : Book 15, Hadith 437
USC-MSA web (English) reference : Book 7, Hadith 3071
  (deprecated numbering scheme)