There is a difference between the exalted titles of "close friend" and "beloved" and these will be explained.
The Prophet, praise and peace be upon him, spoke of his closeness to Sayyiduna Abu Bakr (May Allah be pleased with Him) saying, "If I were to have taken a close friend other than my Lord, I would have taken Abu Bakr."
We are also informed that the Prophet, praise and peace be upon him, said "Your companion (referring to himself) is the close friend of Allah" and this is endorsed by the transmission from Abdullah Ibn Mas'ud (May Allah be pleased with Him) in his narration, "Allah took your companion as a close friend."
In addition to the preceding Prophetic quotation, Sayyiduna Abu Hurayrah (May Allah be pleased with Him) reported that Allah said to His Prophet, praise and peace be upon him, "I have taken you for a close friend, and written in the Torah is 'the Beloved of the Merciful.'"
Prophet Ibrahim Alaihis Salam was called the close friend of Allah "Khalilullah" on account of the ultimate intensity of his devotion to Allah. The friendship of Allah to Ibrahim was that He made him victorious and a role model. On the other hand, there are those who define the root of "khalil", which is "khulla" meaning "in need" as being "a poor person in need". Ibrahim Alaihis Salam was known by this title because his need was only in his Lord and he was devotedly dependent upon Him for his needs and did not depend upon others. We recall how when Ibrahim was about to be cast into the fire, Gabriel Alaihis Salam came to him and asked, "Are you in need of anything?" whereupon he replied, "No, I am not in need of anything from you."
Ibn Abu Bakr Furack (May Allah be pleased with Him) defined the word "khulla" with the meaning of "pure love that necessitates a person being singled out for being infused by secrets."
It has also been said that the root of the word "khulla" is love, and incorporates kindness, help, raising and intercession. This is founded in the verse that reads, "The Jews and the Christians said, "We are the sons of Allah and His beloved ones"; say, "Why does He then punish you for your sins?' [5:18]. It is inconceivable that if a person is beloved, that he should be punished for his sins!
Because of their devotion to Allah, both Prophets Ibrahim and Muhammad, peace be upon them, were titled "close friends." They looked to Him for all their needs and severed themselves from needing anyone else. And, it was either because of the greatness of the concealed kindness of Allah to them, and the disclosed knowledge of the Divine secrets they received, as well as the matters of the Unseen worlds and faith with which they were infused in their inner self that they forsook other means and causes. Or, because their hearts had been purified from anything other than Him, so that love for anything else was prevented from reaching them. For this reason a scholar said, "A person who is 'khalil' is one whose heart has no room for anyone other than Him." Accordingly he is of the opinion that this is what the Prophet, praise and peace be upon him, referred to when he said, "If I were to have taken a close friend other than my Lord, I would have taken Abu Bakr (May Allah be pleased with Him, however, in Islam there is brotherhood."
Opinions vary among the knowledgeable masters of the matters relating to the heart as to which is the higher degree and the question arises is it the degree of close friendship, or the degree of love the higher? On the other hand there are those who consider both degrees as being equal to one another saying that the beloved is a close friend and a close friend is also the beloved. But then, Prophet Ibrahim was given the degree of close friendship and Prophet Muhammad, peace be upon them both, was given love.
In support of the opinion that the degree of friendship is higher, one of the scholars quotes the saying of the Prophet, praise and peace be upon him, that says, "If I were to have taken a close friend other than my Lord …" but he did not do so and we find him using the word 'love' to his daughter Sayyida Fatima, her sons, as well as Osama and others.
One must examine the human basis of love and know that it is the inclination of what the beloved finds pleasing. The love of Allah is not connected to unessential matters. His love for His worshipers is comprised of happiness, protection, success, and affairs that bring him/her closer and His Mercy that overflows upon the recipient. The highest degree is reached when the veils of the heart are removed so that the worshiper sees Him with his heart and looks at Him with his inner eye. This is supported by the Divine quotation that tells us, "When I (Allah) love him I am his hearing by which he hears, the sight by which he sees, and his tongue by which he speaks." One should understand by this that there is nothing better for a worshiper other than seclusion for the sake of Allah, devotion to Him, the turning away from anything other than Allah, the purity of heart and sincerity of actions for the sake of Allah.
Sayyida Ayesha, may Allah be pleased with her, was asked about the Prophet, praise and peace be upon him, and said, "His character was the Qur'an, and his pleasure was its pleasure and his anger was its anger."
It is an undoubted fact that Prophet Muhammad, praise and peace be upon him, was blessed to be the receiver of not only the quality of close friendship but also the very special quality of love.
When the unbelievers said, "Muhammad means we should love him just as the Christians love Jesus, the son of Mary", Allah sent down the verse that reads "Proclaim, (O dear Prophet Mohammed - peace and blessings be upon him), "O mankind! If you love Allah, follow me - Allah will love you and forgive you your sins"; and Allah is Oft Forgiving, Most Merciful." [3:31]. And His anger towards them becomes apparent in the following verse that tells us, "Proclaim, "Obey Allah and the Noble Messenger"; so if they turn away - then Allah is not pleased with the disbelievers." [3:32]. In this verse Allah increased the honor the Prophet, praise and peace be upon him. Note how He issued the command to obey His Prophet, praise and peace be upon him, in connection with obedience to Himself – this is followed by the warning if they choose to turn away, "then truly, Allah does not love the unbelievers."
It has also been said that the limit of the close friend is the desire for forgiveness. Allah quotes the saying of Ibrahim, "And the One Who, upon Whom I pin my hopes, will forgive me my mistakes on the Day of Judgement." [26:82]. Whereas the one who is the beloved is absolutely certain that he will be forgiven, and this is supported in the verse that reads, "So that Allah may forgive, for your sake, the sins of those before you and those after you, and complete His favours upon you, and to show you the Straight Path. " [48:2].
We refer back to Prophet Ibrahim whose rank is that of the close friend and the verse in which he said, "And the One Who, upon Whom I pin my hopes, will forgive me my mistakes on the Day of Judgement." [26:82] and now to the verse "on the day when Allah will not humble the Prophet and the believers along with him; their light will be running ahead of them and on their right;" [66:8].
The "close friend" Ibrahim said, "And give me proper fame among the succeeding generations." [26:84]. Whereas Prophet Muhammad, "the beloved", was told, in the verse "And We have exalted your remembrance for you (O dear Prophet Mohammed - peace and blessings be upon him)." [94:4]. Note how the glad tiding was given to the Prophet, praise and peace be upon him, before the questioning.
And Ibrahim, the close friend of Allah is quoted in the Qur'an saying, "And give me proper fame among the succeeding generations." [26:84], while Allah said to Prophet Muhammad, praise and peace be upon him, "And indeed the latter is better for you than the former." [93:4]
Khalil said: "and safeguard me and my sons from worshiping idols." [14:35] while Allah said to HIS Habib. "Allah only wills to remove all impurity from you, O the People of the Household, and by cleansing you make you utterly pure. (*The Holy Prophet's household.)" [33:33]
The preceding information is sufficient to give one a glimpse into the superiority of the rank, degrees and status of Prophet Muhammad, praise and peace be upon him, and to the inform you of the opinions of the scholars of Islam. Allah says, "Proclaim, Each one works according to his own pattern; and your Lord well knows him who is more upon guidance." [17:84]