Abu Musa Al-Ash`ari (RA reported: The Prophet (SAWS) said, “A person will be summoned with the one whom he loves.” [Al-Bukhari and Muslim].
Another narration is: The Prophet (SAWS) was asked, “What about a person who loves a people but cannot be with them?” (i.e. either he cannot attain their lofty position of righteousness or that he has not met with them in this life). He (SAWS) replied, “A person will be in the company of those whom he loves.”
Besides bringing to eminence the high merit of entertaining the love for the pious persons, this Hadith tells us about the Mercy and Blessings of Allah which He will shower upon those who love the pious people. Because of this love, Allah will elevate even the inferior people and include them among those whom He loves. This Hadith also serves a warning that association and love with the impious people are extremely dangerous as one can meet the same bad end which is inevitable for them. May Allah save us from it.
[Riyad as-Saliheen, Book of Miscellany, Chapter 45, Hadith 368]