I was a young unmarried man who used to sleep in the mosque during the time of the Messenger of Allah ﷺ. Dogs would come and go inside the mosque, and the people did not sprinkle water over any of that.
حدثنا سكن بن نافع الباهلي أبو الحسن حدثنا صالح بن أبي الأخضر عن الزهري
كنت أعزب شابا أبيت في المسجد في عهد رسول الله ﷺ وكانت الكلاب تقبل وتدبر في المسجد فلم يكونوا يرشون شيئا من ذلك
Its chain of transmission is sahih. It is actually two hadiths, the first being about spending the night in the masjid. This has already passed with similar wording at 4607 through the route of Ubaydullah, from Nafi, from Ibn Umar, and it will also come again with similar wording at 5839 through the route of Umari, from Nafi, from Ibn Umar. It is found in Bukhari 1:446 through the route of Ubaydullah.The second is about the dogs coming and going in the masjid. Bukhari narrated it with similar wording at 1:243, through the route of Yunus, from Zuhri, from Hamza bin Abdullah bin Umar, from his father. Qastallani said in 1:210 that Abu Dawud, Ismaili, and Abu Naeem also reported it.