The Messenger of Allah ﷺ said, "A person follows the religion of his close friend, so let each of you look carefully at whom he takes as a friend."
حدثنا محمد بن بشار حدثنا أبو عامر وأبو داود قالا حدثنا زهير بن محمد حدثني موسى بن وردان
قال رسول الله ﷺ الرجل على دين خليله فلينظر أحدكم من يخالل
Its isnad is hasan. Abu Dawud narrated it in the Book of Manners, chapter on who one is commanded to sit with, no. 4833, and Abu Dawud Tayalisi, no. 2573, with a slight difference, and the hadith is transmitted from Muhammad bin Bashshar with this chain, and it has supporting narrations found in Hakim, 4/171, and elsewhere.