The Book of Prayers (Kitab Al-Salat)

Muslim :: Book 4 : Hadith 1541

Abu Qatada, a Companion of the Messenger of Allah (may peace be upon him), said: I entered the mosque, when the Messenger of Allah (may peace be upon him) had been sitting among people, and I also sat down among them. Upon this the Messenger of Allah (may peace be upon him) said: What prevented you from offering two rak'ahs (of Nafl prayer) before sitting down? I said: Messenger of Allah, I saw you sitting and people sitting (around you and I, therefore, sat in your company). He (the Holy Prophet) then said: When anyone among you enters the mosque, he should not sit till he has observed two rak'ahs.

Source materials are from the University of Southern California MSA site
Hadith eBooks converted from Imaan Star