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.'"
أَنَّ النَّبِيَّ ﷺ اتَّخَذَ حُجْرَةً فِي الْمَسْجِدِ مِنْ حَصِيرٍ فَصَلَّى رَسُولُ اللَّهِ ﷺ فِيهَا لَيَالِيَ حَتَّى اجْتَمَعَ إِلَيْهِ النَّاسُ ثُمَّ فَقَدُوا صَوْتَهُ لَيْلَةً فَظَنُّوا أَنَّهُ نَائِمٌ فَجَعَلَ بَعْضُهُمْ يَتَنَحْنَحُ لِيَخْرُجَ إِلَيْهِمْ فَقَالَ مَا زَالَ بِكُمُ الَّذِي رَأَيْتُ مِنْ صُنْعِكُمْ حَتَّى خَشِيتُ أَنْ يُكْتَبَ عَلَيْكُمْ وَلَوْ كُتِبَ عَلَيْكُمْ مَا قُمْتُمْ بِهِ فَصَلُّوا أَيُّهَا النَّاسُ فِي بُيُوتِكُمْ فَإِنَّ أَفْضَلَ صَلاَةِ الْمَرْءِ فِي بَيْتِهِ إِلاَّ الصَّلاَةَ الْمَكْتُوبَةَ