The Messenger of Allah ﷺ said, "A person will be with those he loves, and he will have what he has earned."
حدثنا أبو هشام الرفاعي حدثنا حفص بن غياث عن أشعث عن الحسن
قال رسول الله ﷺ المرء مع من أحب وله ما اكتسب
No references are available.
[Its chain of transmission is daif] Ahmad narrated it in 3/226 from the hadith of Hasan with the same wording, and Ibn Hibban graded it sahih (Al-Ihsan) 565. The hadith has very many corroborating narrations, apart from his statement, "and he has what he earned," and the Quran supports this, so the hadith is hasan li-ghayrihi.On this subject there are also narrations from Ali [Bazzar (Kashf Astar) 4/229, no. 3596], Abdullah bin Masud [Bukhari, no. 6168, and Muslim, no. 2640], Safwan bin Assal [coming up, 2387], Abu Hurairah [previously mentioned, 2378], and Abu Musa [Bukhari, no. 6170, and Muslim, no. 2641].