Bismillahir Rahmanir Rahim
Nahmaduhu wa Nusalli ‘alaa Rasulihil Kareem,
wa ‘alaa Aalihi wa Sahbihi wa Awliyaaihi ajma’een.
Allahu ta ‘ala has commanded us to keep the company of pious people, to visit them to learn from them, to benefit from them and to do benefit [help] to them. Our salvation lies in obeying the commands of Allahu ta ‘ala and His Beloved Sayyidinaa wa Mawlaana Muhammad Sall Allahu ‘alaihi wa Aalihi wa Sallim
Allahu ta ‘ala says:
وَاصْبِرْ نَفْسَكَ مَعَ الَّذِينَ يَدْعُونَ رَبَّهُمْ بِالْغَدَاةِ وَالْعَشِيِّ يُرِيدُونَ وَجْهَهُ ۖ وَلَا تَعْدُ عَيْنَاكَ عَنْهُمْ تُرِيدُ زِينَةَ الْحَيَاةِ الدُّنْيَا ۖ وَلَا تُطِعْ مَنْ أَغْفَلْنَا قَلْبَهُ عَنْ ذِكْرِنَا وَاتَّبَعَ هَوَاهُ وَكَانَ أَمْرُهُ فُرُطًا [١٨:٢٨]
And keep thy soul content with those who call on their Lord morning and evening, seeking His Face; and let not thine eyes pass beyond them, seeking the pomp and glitter of this Life; nor obey any whose heart We have permitted to neglect Our Dhikr [remembrance], one who follows his own desires, whose case has gone beyond all bounds. Suratul Kahf, 28th Ayah.
The circumstances behind the sending down of this ayah are as follows;
Sayyidinaa Salman al-Farisi Radhi Allahu anhu who said: “Those whose hearts were to be reconciled (al-mu’allafati qulubuhum) – were ‘Uyaynah ibn Hisn, al-Aqra’ ibn Habis and their families – who came to the Messenger of Allah, Sall Allahu ‘alaihi wa Aalihi wa Sallim, and said: ‘O Messenger of Allah, if only you could sit at the front of the assembly and remove these people – meaning: Salman al-Farisi, Abu Dharr al-Ghifari and other poor Muslims – and their smelly outer garments – because the only thing they had on them were these woolen outer garments – from us, then we could sit with you, talk to you and learn from you!’ 
As a response, Allah, exalted is He, revealed (And recite that which hath been revealed unto thee of the Scripture of thy Lord. There is none who can change His words, and thou wilt find no refuge beside Him. Restrain thyself along with those who cry unto their Lord at morn and evening, seeking His Countenance) [18:27-28] up to His words (Lo! We have prepared for disbelievers Fire…) [18:29], threatening them with hell.
The Prophet, Sall Allahu ‘alaihi wa Aalihi wa Sallim, stood up and went looking for them. He found them at the back of the masjid making dhikr of Allah, exalted is He. He said: ‘Praise be to Allah Who did not take away my soul until He commanded me to content myself with men of my community. It is with you that I live and with you that I die’ ”. (…and obey not him whose heart We have made heedless of Our remembrance…) [18:28]. [Asbaabun Nuzul al Wahidi]
Allahu ta ‘ala mentions in Suratul Kahf the journey of Sayyidinaa Musa ‘alaihi salaam in search of knowledge:
Behold, Sayyidinaa Musa said to his attendant, “I will not give up until I reach the junction of the two seas or (until) I spend years and years in travel.” Suratul Kahf 60th ayah.
Imam Jalaaluddin Suyuti Rahmatullahi ‘alaihi mentions in “Tafsir Jalalayn” That the attendant of Sayyidinaa Musa alaihi salaam, Yusha bin Nun used to follow him around serve him and learn from him as a student, keeping his company. This is the attendant who accompanied Sayyidinaa Musa on his journey to Meet Shaykh Khidhr ‘alaihi salaam.
“And, mention, when Sayyidinaa Musa , son of Amram (‘Imrān), said to his attendant, Joshua son of Nun (Yūsha‘ bin Nūn), who used to follow him around, serve him and acquire knowledge from him, ‘I will not give up, I will not stop journeying, until I have reached the juncture of the two seas — the point where the Byzantine sea and the Persian sea meet, beyond the east, — though I march on for ages’, for a very long time before reaching it, if it be far.” [Tafsir Jalaalayn]
Further Allahu ta ‘ala say in Suratul Kahf:
“So they found one of Our servants, on whom We had bestowed Mercy from Ourselves and whom We had taught knowledge from Our own Presence.”
Sayyidinaa Musa said to him: “May I follow thee, on the footing that thou teach me something of the (Higher) Truth which thou hast been taught?”
(The other) said: “Verily thou wilt not be able to have patience with me!”
“And how canst thou have patience about things about which thy understanding is not complete?”
Sayyidinaa Musa said: “Thou wilt find me, if Allah so will, (truly) patient: nor shall I disobey thee in aught.” Suratul Kahf 65-68 Ayaah
Imam Jalaluddin Suyuti Rahmatullah ‘alaihi mentions;
“So [there] they found one of Our servants, namely, al-Khidr, to whom We had given mercy from Us — according to one opinion this [mercy] was prophethood; according to another it was authority (wilayat), and this [latter] is the opinion of the majority of scholars — and We had taught him knowledge from Us (‘ilman is the second direct object), in other words, some knowledge of unseen things [‘Ilmul Ghayb].”
Al Imam Bukhārī Rahmatullahi ‘alaihi reports the [following] hadīth: ‘Sayyidinaa Musa was delivering a sermon among the Children of Israel and was asked, “Who is the most knowledgeable of people?” to which he [Sayyidinaa Musa] said, “Myself”. God then reproached him for not having attributed [his] knowledge as [coming] from Him. God then revealed to him the following: “Truly, there is a servant of Mine at the juncture of the two seas; he is more knowledgeable than you”.
Sayyidinaa Musa then asked, “My Lord, how do I reach him?” He [God] said, ‘Take a fish with you and place it in a basket and [the place] where you lose the fish will be [the place] where he is.” He [Sayyidinaa Musa] took a fish and placed it in a basket and departed together with his lad Joshua son of Nun until they reached the rock. [There] they placed their heads back and fell asleep. The fish began to move about in the basket, until it escaped from it and fell into the sea, and it made its way into the sea in an amazing manner. God then held back the flow of the water [preventing it] from [engulfing] the fish, forming a kind of arch over it.
When he awoke, his companion [Joshua] forgot to inform him of [what had happened to] the fish, and so they journeyed on for the remainder of that day and night until on the morning [of the second day] Sayyidinaa Musa said to his lad, ‘Bring us our breakfast’, to where he says, and it made its way into the sea in an amazing manner’. He [Bukhārī] said, ‘For the fish, it [the way into the sea] was [by] ‘burrowing’ (saraban), and for Sayyidinaa Musa and his lad it [this way] was ‘amazing’ (‘ajaban) …’ [and so on] to the end [of Bukhārī’s report]. [Tafsir Jalaalayn]
Imam An Nawawi mentions in “Riyadh as Saliheen”;
Sayyidinaa Anas bin Malik (May Allah be pleased with him) reported: After the passing of Messenger of Allah (Sall Allahu ‘alaihi wa Aalihi wa Sallim), Sayyidinaa Abu Bakr (May Allah be pleased with him) said to `Umar (May Allah be pleased with him): “Let us visit Umm Aiman (May Allah be pleased with her) as Messenger of Allah (Sall Allahu ‘alaihi wa Aalihi wa Sallim) used to visit her”.
As we came to her, she wept. They (Abu Bakr and `Umar (Radhi Allahu anhumma) said to her, “What makes you weep? Do you not know that what Allah has in store for His Messenger (Sall Allahu ‘alaihi wa Aalihi wa Sallim) is better than (this worldly life)?” She said, “I weep not because I am ignorant of the fact that what is in store for Messenger of Allah (Sall Allahu ‘alaihi wa Aalihi wa Sallim) (in the Hereafter) is better than this world, but I weep because the Revelation has ceased to come”. This moved both of them to tears and they began to weep along with her. [Muslim]. 
Abu Sayyidinaa Musa Al-Ash`ari (May Allah be pleased with him) reported: I heard the Prophet (Sall Allahu ‘alaihi wa Aalihi wa Sallim) saying, “The similitude of good company and that of bad company is that of the owner of musk and of the one blowing the bellows. The owner of musk would either offer you some free of charge, or you would buy it from him, or you smell its pleasant fragrance; and as for the one who blows the bellows (i.e., the blacksmith), he either burns your clothes or you smell a repugnant smell”.
[Al-Bukhari and Muslim].
Al–Haafidh ibn Hajar al Asqalaani Rahmatullahi ‘alaihi, commenting on this Hadeeth said, “There is in this Hadeeth prohibition of keeping the company of those who can harm one in religious and worldly matters; and an encouragement for keeping the company of those who can benefit one in these matters.”
This Hadith enjoins us to sit in the company of the pious people and avoid those of bad character. The pious people like the shop keeper selling attar [attarwala] will leave an impression on the visitor. Likewise the company of the people of bad character will also leave an impression. By visiting and associating with the pious friends of Allahu ta ‘ala and the Ulema al Haqq one can only benefit. Whereas keeping the company of impious people who flaunt the commandments of Allahu ta ‘ala and His beloved (Sall Allahu ‘alaihi wa Aalihi wa Sallim), will only lead one down the path of destruction, as one must eventually take on their manners, beliefs and characteristics.
May Allahu ta ‘ala protect us from falling in with the company of the impious people. May Allahu ta ‘ala allow us to understand the importance of and allow is to be in the company of the pious friend of Allah from among the ‘Ulama and the Awliya. May Allahu ta ‘ala allow us to be those who help them and love them, support then and benefit from the Ameen.
Wa Sall Allahu ta ‘ala alaa Sayyidinaa wa Mawlaana Muhammadin wa ‘alaa Aalihi wa Ashaabihi wa Awliyaa-e-he wa Ummatihi ajma’een, birahmatika Yaa Arhamar Rahimeen.
 Uyaynah and the likes of him including Umayya bin Khalaf did not want to sit in the company of the poor Sahaabahs. They felt that because of their wealth and status among the people in the society that they deserves to sit closest to the Holy Prophet Sall Allahu ‘alaihi wa Aalihi wa Sallim. They thought they were better than Salman al Farisi and Abu Dharr Radhi Allahu anhumma, though the opposite was the reality.
 Umm Aiman (May Allah be pleased with her) belonged to Ethiopia and was a slave-girl of the Prophet’s father (`Abdullah bin `Abdul-Muttalib). After the passing away of `Abdullah, Umm Aiman (May Allah be pleased with him) remained with the Prophet’s mother, Aminah, and took great care in his upbringing. Subsequently, the Prophet (Sall Allahu ‘alaihi wa Aalihi wa Sallim) set her free and then she was married to Zaid bin Harithah (May Allah be pleased with her).
This Hadith shows that this blessed Sahaabiya spend company with the Messenger of Allah (Sall Allahu ‘alaihi wa Aalihi wa Sallim) and he (Sall Allahu ‘alaihi wa Aalihi wa Sallim) used to visit her. This hadith also gives the justification for weeping over the death of the pious and also shows that it is desirable to visit such persons to whom one’s friends go to pay respect. The incident mentioned in this Hadith also shows the love that the Companions of the Prophet (Sall Allahu ‘alaihi wa Aalihi wa Sallim) had for him.