He used to sleep in the mosque of the Prophet ﷺ, as he was a young unmarried man with no family.
أنه كان ينام- وهو شاب أعزب لا أهل له- في مسجد النبي ﷺ.
Bukhari narrated it in the Book of Prayer (440), and Muslim in the Book of Virtues (2479), both of them through Ubaydullah bin Umar, who said, "Nafi told me, saying, 'Abdullah bin Umar informed me,'" and he related it. The wording is that of Bukhari.