It is narrated from Sulaiman bin Yasar (may Allah have mercy on him) that Umar bin Khattab (may Allah be pleased with him) stood to deliver a sermon at Jabiyah and said: The Messenger of Allah (ﷺ) stood among us just as I am standing, and he (ﷺ) said: “Honor my companions, then those who are close to them (the Followers), then those who are close to them (the Followers of the Followers). Then falsehood will become widespread to the extent that a person will swear an oath without being asked to do so, and he will bear witness without being asked to bear witness. Beware! Whoever wishes to reside in the middle part of Paradise should remain with the congregation, for indeed Satan is with the one who is alone, while he is farther from two people (because of their unity). And no man should be alone with a non-mahram woman, for Satan is the third among them. And whoever is pleased by his good deed and saddened by his bad deed, then he is a believer.”
Hadith Referenceمسند الإمام الشافعي / كتاب فضائل قريش وغيرهم وأبواب متفرقة / 1788
Hadith Takhrijأخرجه الترمذى الفتن، باب ماجاء في لزوم الجماعة (2165) وقال حسن صحيح - وابن ماجة ، الشهادات باب كراهية الشهادة لمن لم يستشهد (2363) وصححه ابن حبان۔