Abu Musa al-Ash’ari narrated that the Prophet r said: “A good friend and a bad friend are like a perfume-seller and a blacksmith: The perfume-seller might give you some perfume as a gift, or you might buy some from him, or at least you might smell its fragrance. As for the blacksmith, he might singe your clothes, and at the very least you will breathe in the fumes of the furnace.” [Bukhari]
ItIt is a concern in Islam to lead or guide the Muslims in the gathering of good people because the human is affected in a good way or in a bad way by his friend. Thus, he should keep company with the righteous people.
– Also, it warns the Muslim from making friendship with or accompanying bad people such as those who don’t pray, those who don’t follow the Sunnah, those who smoke, etc…