كتاب صلاة المسافرين وقصرها
6  
The Book of Prayer - Travellers
(29)
Chapter: It is recommended to offer voluntary prayers in one’s house although it is permissible to offer them in the masjid
(29)
باب اسْتِحْبَابِ صَلاَةِ النَّافِلَةِ فِي بَيْتِهِ وَجَوَازِهَا فِي الْمَسْجِدِ ‏‏
Sahih Muslim 781 b

Zaid b. Thabit reported that the Messenger of Allah (ﷺ) made an apartment in the mosque of mats, and he observed in it prayers for many nights till people began to gather around him, and the rest of the hadith is the same but with this addition:

" Had this (Nafl) prayer become obligatory for you, you would not be able to observe it."
وَحَدَّثَنِي مُحَمَّدُ بْنُ حَاتِمٍ، حَدَّثَنَا بَهْزٌ، حَدَّثَنَا وُهَيْبٌ، حَدَّثَنَا مُوسَى بْنُ عُقْبَةَ، قَالَ سَمِعْتُ أَبَا النَّضْرِ، عَنْ بُسْرِ بْنِ سَعِيدٍ، عَنْ زَيْدِ بْنِ ثَابِتٍ، أَنَّ النَّبِيَّ صلى الله عليه وسلم اتَّخَذَ حُجْرَةً فِي الْمَسْجِدِ مِنْ حَصِيرٍ فَصَلَّى رَسُولُ اللَّهِ صلى الله عليه وسلم فِيهَا لَيَالِيَ حَتَّى اجْتَمَعَ إِلَيْهِ نَاسٌ ‏.‏ فَذَكَرَ نَحْوَهُ وَزَادَ فِيهِ ‏ "‏ وَلَوْ كُتِبَ عَلَيْكُمْ مَا قُمْتُمْ بِهِ ‏"‏ ‏.‏
Reference : Sahih Muslim 781b
In-book reference : Book 6, Hadith 254
USC-MSA web (English) reference : Book 4, Hadith 1709
  (deprecated numbering scheme)