Do not accompany except a believer
Abu Sa'eed (may Allah be pleased with him) narrated that the Messenger of Allah(may the peace and blessings of Allah be upon him) said:
"Do not accompany except a believer, and do not serve your food except to one with Taqwa."
Accompanying the good people brings nothing by goodness, even though one found disliked traits in his companion, one shall disregard such trivial things to maintain the ties of brotherhood for the sake of Allah.
This is fitting for the believer, because he has a pure nature, with a sound heart that is free of all that disturbs the faith. The believer will not feel comfortable with a man who is quite the opposite. Therefore, he shall search for the religiously committed friends.
The Prophet (may the peace and blessings of Allah be upon him) ordered the believer to accompany a believer like him, so as to guard against the evil consequences of accompanying the wicked people.
Please be informed that the souls are like the recruited soldiers, they get mixed up with those similar with them in qualities and oppose and drift away from those who do not share their qualities
The Hadith indicates that one will follow the ways, the doctrine and his behavior, etc… in addition to his other traits.
One shall have more than one close friend, whom he takes as brothers until they are as one man.