Jami` at-Tirmidhi, Book 36, Hadith 75 (Tirmidhi 2447)

Abu Hurairah narrated that the Messenger of Allah(s.a.w) said:

"A man is upon the religion of his friend, so let one of you look at whom he befriends."