The Prophet ﷺ used some palm fiber mats to section off a small area in the masjid. And the Messenger of Allah ﷺ prayed in it for several nights until the people gathered around him. Then, one night they did not hear his voice, and they thought that he was sleeping, so they cleared their throats to make him come out to them. He said: 'You kept doing that until I feared that it would be made obligatory for you, and if it were made obligatory, you would not be able to do it. O people, pray in your houses, for the best prayer a person offers is in his house, apart from the prescribed (obligatory) prayers.'" (Using translation from Nasāʾī 1599)
أَنَّ النَّبِيَّ ﷺ اتَّخَذَ حُجْرَةً فِي الْمَسْجِدِ مِنْ حَصِيرٍ فَصَلَّى فِيهَا رَسُولُ اللهِ ﷺ لَيَالِيَ حَتَّى اجْتَمَعَ إِلَيْهِ نَاسٌ ثُمَّ فَقَدُوا صَوْتَهُ فَظَنُّوا أَنَّهُ قَدْ نَامَ فَجَعَلَ بَعْضُهُمْ يَتَنَحْنَحُ لِيَخْرُجَ إِلَيْهِمْ فَقَالَ مَا زَالَ بِكُمُ الَّذِي رَأَيْتُ مِنْ صَنِيعِكُمْ حَتَّىخَشِيتُ أَنْ يُكْتَبَ عَلَيْكُمْ وَلَوْ كُتِبَ عَلَيْكُمْ مَا قُمْتُمْ بِهِ فَصَلُّوا أَيُّهَا النَّاسُ فِي بُيُوتِكُمْ فَإِنَّ أَفْضَلَ صَلَاةِ الْمَرْءِ فِي بَيْتِهِ إِلَّا الصَّلَاةَ الْمَكْتُوبَةَ