Short answer
They are brothers in prophethood, not close relatives by blood. Both descend from Abraham: Jesus through Isaac and the Children of Israel, Muhammad ﷺ through Ishmael. The Prophet ﷺ said he is the closest of people to Jesus and that no prophet came between them. Muslims hold that Muhammad ﷺ is the highest-ranking messenger, while forbidding any comparison that belittles Jesus.
Muslims believe in all the prophets without rejecting or belittling any. Ahl al-Sunnah hold that Muhammad ﷺ is the best of the prophets, based on the Quran and authentic hadith. Comparing prophets in a way that lowers any of them, or out of argument and pride, is forbidden.
The four schools agree on this.
Explanation
Both prophets come from the family of Abraham. Jesus was born to Mary of the family of Imran, among the Children of Israel, descendants of Isaac and Jacob. Muhammad ﷺ was born in Makkah among the Arabs, descendants of Ishmael. So they are distant kin through Abraham, about six centuries apart.
Their spiritual bond is much closer. The Prophet ﷺ said: "I am the closest of people to the son of Mary. The prophets are brothers by one father, and there was no prophet between me and him." Jesus, the Quran says, gave good news of "a messenger to come after me, whose name is Ahmad". On the night journey the Prophet ﷺ met Jesus and his cousin John in the second heaven. And when Jesus returns, he will follow the shariah brought by Muhammad ﷺ.
Is one greater? The Quran says "some of them We caused to exceed others", and the Prophet ﷺ said he will be the master of the children of Adam on the Day of Resurrection. Yet he also said: "Do not make distinctions between the prophets." Scholars reconcile these: preference among prophets is known only from revelation, and must never be used to belittle any of them or in heated argument. In belief, Muslims "make no distinction between any of His messengers": all are true and all are loved.
See what the hadith say about Jesus, Prophet Muhammad and Prophet Isa.
The evidence
Quran, Surah As-Saff 61:6
وَإِذْ قَالَ عِيسَى ٱبْنُ مَرْيَمَ يَٰبَنِىٓ إِسْرَٰٓءِيلَ إِنِّى رَسُولُ ٱللَّهِ إِلَيْكُم مُّصَدِّقًۭا لِّمَا بَيْنَ يَدَىَّ مِنَ ٱلتَّوْرَىٰةِ وَمُبَشِّرًۢا بِرَسُولٍۢ يَأْتِى مِنۢ بَعْدِى ٱسْمُهُۥٓ أَحْمَدُ ۖ فَلَمَّا جَآءَهُم بِٱلْبَيِّنَٰتِ قَالُوا۟ هَٰذَا سِحْرٌۭ مُّبِينٌۭ ﴿٦﴾
And [mention] when Jesus, the son of Mary, said, "O children of Israel, indeed I am the messenger of Allah to you confirming what came before me of the Torah and bringing good tidings of a messenger to come after me, whose name is Ahmad." But when he came to them with clear evidences, they said, "This is obvious magic."
Jesus foretold the coming of Muhammad ﷺ.
Quran, Surah Al-Baqara 2:253
۞ تِلْكَ ٱلرُّسُلُ فَضَّلْنَا بَعْضَهُمْ عَلَىٰ بَعْضٍۢ ۘ مِّنْهُم مَّن كَلَّمَ ٱللَّهُ ۖ وَرَفَعَ بَعْضَهُمْ دَرَجَٰتٍۢ ۚ وَءَاتَيْنَا عِيسَى ٱبْنَ مَرْيَمَ ٱلْبَيِّنَٰتِ وَأَيَّدْنَٰهُ بِرُوحِ ٱلْقُدُسِ ۗ وَلَوْ شَآءَ ٱللَّهُ مَا ٱقْتَتَلَ ٱلَّذِينَ مِنۢ بَعْدِهِم مِّنۢ بَعْدِ مَا جَآءَتْهُمُ ٱلْبَيِّنَٰتُ وَلَٰكِنِ ٱخْتَلَفُوا۟ فَمِنْهُم مَّنْ ءَامَنَ وَمِنْهُم مَّن كَفَرَ ۚ وَلَوْ شَآءَ ٱللَّهُ مَا ٱقْتَتَلُوا۟ وَلَٰكِنَّ ٱللَّهَ يَفْعَلُ مَا يُرِيدُ ﴿٢٥٣﴾
Those messengers - some of them We caused to exceed others. Among them were those to whom Allah spoke, and He raised some of them in degree. And We gave Jesus, the Son of Mary, clear proofs, and We supported him with the Pure Spirit. If Allah had willed, those [generations] succeeding them would not have fought each other after the clear proofs had come to them. But they differed, and some of them believed and some of them disbelieved. And if Allah had willed, they would not have fought each other, but Allah does what He intends.
Allah gave some messengers higher rank than others.
Quran, Surah Al-Baqara 2:285
ءَامَنَ ٱلرَّسُولُ بِمَآ أُنزِلَ إِلَيْهِ مِن رَّبِّهِۦ وَٱلْمُؤْمِنُونَ ۚ كُلٌّ ءَامَنَ بِٱللَّهِ وَمَلَٰٓئِكَتِهِۦ وَكُتُبِهِۦ وَرُسُلِهِۦ لَا نُفَرِّقُ بَيْنَ أَحَدٍۢ مِّن رُّسُلِهِۦ ۚ وَقَالُوا۟ سَمِعْنَا وَأَطَعْنَا ۖ غُفْرَانَكَ رَبَّنَا وَإِلَيْكَ ٱلْمَصِيرُ ﴿٢٨٥﴾
The Messenger has believed in what was revealed to him from his Lord, and [so have] the believers. All of them have believed in Allah and His angels and His books and His messengers, [saying], "We make no distinction between any of His messengers." And they say, "We hear and we obey. [We seek] Your forgiveness, our Lord, and to You is the [final] destination."
Muslims believe in all messengers equally as true.
Sahih al-Bukhari 3442
Sahih... أنا أولى الناس بابن مريم والأنبياء أولاد علات ليس بيني وبينه نبي ...
"I am the closest of people to the son of Mary. The prophets are brothers by one father, and there was no prophet between me and him."
The special closeness between the two prophets.
Sahih Muslim 2278
Sahih... أنا سيد ولد آدم يوم القيامة ...
"I will be the master of the children of Adam on the Day of Resurrection."
The basis for the Sunni belief that Muhammad ﷺ is the highest in rank.
Sahih al-Bukhari 2412
Sahih... لا تخيروا بين الأنبياء ...
"Do not make distinctions between the prophets."
Comparisons must never belittle any prophet.
Where the ruling is recorded
- al-Aqida al-Tahawiyya, the section on the Prophet ﷺ as the seal of the prophets. Describes him as the seal of the prophets and the master of the messengers.
Checked by our team. For a more accurate answer to your own situation, consult a scholar. Quran translation by Sahih International. Hadith Arabic from the standard editions of the six books and the Muwatta, with gradings as recorded there; the English is our own rendering. Spotted a mistake? Tell us.