Praise be to Allah.
Saying that you love your brothers and friends is part of the etiquette of keeping righteous company, and is a noble and good characteristic.
Telling people that you love them increases the bonds of love and strengthens the ties among Muslims.
It was narrated from Anas ibn Maalik (may Allah be pleased with him) that a man was with the Prophet (peace and blessings of Allah be upon him) when another man passed by and he said: O Messenger of Allah, I love this man. The Prophet (peace and blessings of Allah be upon him) said to him: “Have you told him?” He said: No. He said: “Tell him.” So he caught up with him and said: I love you for the sake of Allah. He said: May the one for Whose sake you love me also love you. Narrated by Abu Dawood (no. 5125) and classed as saheeh by al-Nawawi in Riyadh al-Saaliheen (183) and classed as hasan by al-Albani in Saheeh Abi Dawood. In some reports of the hadeeth it says: “Tell him for it will strengthen the love between you.” Narrated by Ibn Abi’l-Dunya in al-Ikhwaan (69).
Shaykh Ibn ‘Uthaymeen (may Allah have mercy on him) said:
That is because this word will instil love in his heart, because if a person knows that you love him, he will love you, even though hearts may recognize and love one another without actually speaking, as the Prophet (peace and blessings of Allah be upon him) said: “Souls are like conscripted soldiers; those whom they recognize, they get along with, and those whom they do not recognize, they will not get along with.” But if a person says it with his tongue, this will increase the love in the heart, so you should say: “I love you for the sake of Allah.”(Sharh Riyadh al-Saaliheen).
It was narrated that al-Miqdaam ibn Ma’di Yakrib (may Allah be pleased with him) said: The Messenger of Allah (peace and blessings of Allah be upon him) said: “If one of you loves his brother, let him tell him.” Narrated by al-Tirmidhi (2392) and classed as hasan by al-Albani in al-Silsilah al-Saheehah (417).
It was narrated from ‘Ali ibn al-Husayn ibn ‘Ali ibn Abi Taalib (may Allah be pleased with him) that the Messenger of Allah (peace and blessings of Allah be upon him) said: “If one of you loves his brother for the sake of Allah, let him tell him, for it does good and makes the love last.”
Shaykh al-Albani said in al-Silsilah al-Saheehah (1199):
It was narrated by Wakee’ in al-Zuhd (2/67/2) with a saheeh isnaad from ‘Ali ibn al-Husayn in a marfoo’ report.
I (al-Albani) say: ‘Ali ibn al-Husayn is the grandson of ‘Ali ibn Abi Taalib; he is thiqah jaleel (honest and great man) one of the men of the two Shaykhs (al-Bukhari and Muslim). So it is mursal with a saheeh isnaad.
There is corroborating evidence in the hadeeth of Mujaahid which is also mursal; this was narrated by Ibn Abi’l-Dunya in Kitaab al-Ikhwaan and in al-Fath al-Kabeer (1/67). There is another corroborating report from Yazeed ibn Na’aamah al-Dubbi, which I narrated in the other book (1726). When all the isnaads are taken into account, the hadeeth is hasan, in sha Allah. End quote.
What is meant here is that it is mustahabb; it is not obligatory.
Al-Manaawi (may Allah have mercy on him) said:
“Let him tell him that he loves him for the sake of Allah” means, it is mustahabb for him to tell him, by saying I love you for the sake of Allah, i.e., not for any other reason such as kindness and so on, because it ensures that the bond will last longer and makes love stronger, and it increases and multiplies love, and brings people together, thus the Muslims will be united, and troubles and grudges will be dispelled. This is one of the good features of Islam."(Fayd al-Qadeer 1/319).
See also the answer to question no. 173.
And Allah knows best.