Hadithcore
Riyad as-Salihin, 368

Abu Musa Al-Ash'ari (May Allah be pleased with him) reported:

The Prophet (ﷺ) said, "A person will be summoned with the one whom he loves". <b>[Al-Bukhari and Muslim]</b>. Another narration is: The Prophet (ﷺ) 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 (ﷺ) replied, "A person will be in the company of those whom he loves".

وعن أبي موسى الأشعري رضي الله عنه أن النبي صلى الله عليه وسلم قال‏:‏ ‏"‏ المرء مع من أحب‏"‏ ‏(‏‏(‏متفق عليه‏)‏‏)‏ ‏.‏ وفي رواية قال‏:‏ قيل للنبي صلى الله عليه وسلم ‏:‏ الرجل يحب القوم ولما يلحق بهم‏؟‏ قال‏:‏ ‏"‏المرء مع من أحب‏"‏‏.‏

References1 variant
In-Book Reference
Introduction, Hadith 368
Sharh · explanationclick to expand
<b>Guidance from the Hadith:</b><br> 1) A Muslim should love the pious in order for him to join them, for one will be gathered on the Day of Judgment with those whom he loves.<br> 2) Loving others for Allah’s sake is an act of worship that enables one to make up for what he has missed or neglected of other acts of worship.<br> 3) The variance among the believers with regard to their degrees of servitude to Allah does not prevent the negligent one from joining the excellent, since the root of faith-based love, which is one of the highest deeds of the hearts, is a common factor between them.<br> 4) The merit of loving the righteous, from among the people of knowledge and religiosity, on top of whom come the Companions (may Allah be pleased with them) and the righteous predecessors. So, let those who take them as allies rejoice! And woe to those who bears hatred and enmity towards them.