Hadith Q1829
And the explanation of the evidence that the prohibition of sitting in the mosque without offering two rak‘ahs upon entering is for discipline, not for prohibition—rather, it is an encouragement towards goodness and virtue. Imam Abu Bakr, may Allah have mercy on him, says that in the narration of Hazrat Talhah bin ‘Ubaidullah, it is mentioned that a Bedouin came to the service of the Prophet Muhammad (peace be upon him) and asked, “Which prayers has Allah made obligatory upon me?” The Prophet (peace be upon him) replied: “Five prayers are obligatory, apart from them whatever voluntary prayers you offer.” I have mentioned other similar narrations in the first volume of Kitab al-Kabir, in the Book of Prayer. In this way, the Prophet (peace be upon him) clarified that only five prayers are obligatory, and all prayers besides the five daily prayers are voluntary; none of them are obligatory.
Hadith Reference صحيح ابن خزيمه / Q1829