The belief that all Muslims (who are believers) will leave Hell is a belief agreed upon in Sunni Islam. This is in contrast to the Mutazilah and the Khawarij who believed that Muslims who committed major sins would stay in Hell forever, and some of them believed that a person who committed major sins would no longer be a Muslim.
One of the standard creeds of Sunni Islam, Aqidah Tahawiyyah states:
Those who commit major sins among the nation of Muhammad, peace and blessings be upon him, may be in Hellfire but will not reside there forever, if they die while they are monotheists, even if they have not repented. After they meet Allah knowing faith, they are subject to His will and His judgment. If He wills, He will forgive them and pardon them by His grace, as mentioned by the Almighty in His book, ‘He forgives whatever is less than idolatry for whomever He wills, (4:116)
If He wills, He will punish them in Hellfire by His justice. Thereafter, He will bring them out of Hellfire by His mercy and the intercession of intercessors among those obedient to Him, then raise them to Paradise. This is because Allah the Exalted is the ally of those who recognize Him and He will not deal with them in the two abodes as if they were the people who rejected Him, who failed to follow His guidance and did not earn His guardianship. O Allah, Guardian of Islam and its people, keep us firmly upon Islam until we meet You. (Aqidah Tahawiyyah)
Evidence
There is a plethora of evidence for the position of the Sunnis. The first, as already quoted before, are the verses in the Quran:
Indeed, Allah does not forgive association with Him, but He forgives what is less than that for whom He wills [...] (4:48 and 4:116)
Indeed, those who disbelieved and averted [people] from the path of Allah and then died while they were disbelievers - never will Allah forgive them (47:34)
Ask forgiveness for them, [O Muhammad], or do not ask forgiveness for them. If you should ask forgiveness for them seventy times - never will Allah forgive them. That is because they disbelieved in Allah and His Messenger, and Allah does not guide the defiantly disobedient people. (9:80)
These verses prove that the only sin that is not forgiven by Allah for eternity is the sin of shirk and kufr.
Allah specifying kufr and shirk for eternal punishment and for being unforgiveable shows that major sins are sins that will be forgiven in Allah's complete mercy.
The other major evidences are the mutawatir narrations regarding the fact that anyone who has the tiniest amount of Iman will leave Hell:
Allah's Messenger (ﷺ) said, "When the people of Paradise have entered Paradise, and the people of the Fire have entered the Fire, Allah will say. 'Take out (of the Fire) whoever has got faith equal to a mustard seed in his heart.' They will come out, and by that time they would have burnt and became like coal, and then they will be thrown into the river of Al-Hayyat (life) and they will spring up just as a seed grows on the bank of a rainwater stream." The Prophet (ﷺ) said, "Don't you see that the germinating seed comes out yellow and twisted?" (Sahih al-Bukhari and Sahih Muslim)
Then, there are the narrations regarding the people who say La Ilaha Illallah:
The Messenger of Allah (ﷺ) said. He who died knowing (fully well) that there is no god but Allah will enter Paradise. (Sahih Muslim)
There are also the many hadith about intercession (which is one of the methods of how a person will leave Hell):
The Prophet said: [Allah will say on the Day of Judgement]: O Muhammad, raise thy head, and say and it would be listened to; ask and it would be granted, intercede and it would be accepted.
I shall say: My Lord, my people, my people.
It would be said: Go, and bring forth from it (Hell) him who has in his heart faith equal to the weight of a wheat grain or a barley seed.
I would go and do that; then I would return to my Lord and extol Him with those praises (taught to me by Allah), then I would fall in prostration.
It would be said to me: O Muhammad, raise your head, and say and it would be heard; ask and it would be granted; intercede and intercession would be accepted.
So I would say: My people. my people.
It would be said to me: Go and take out from it (Hell) him who has in his heart faith equal to the weight of a mustard seed.
I would go and do that. I would again return to my Lord and extol Him with those praises. I would then fall in prostration.
It would be said to me: O Muhammad, raise your head: say, and you would be listened to; ask and it would be granted; intercede and intercession would be accepted.
I would say: My Lord, my people, my people.
It would be said to me: Go, and bring out of the Fire him who has in his heart as much faith as the smallest, smallest, smallest grain of mustard seed. I would go and do that. (Sahih Muslim)
This hadith mentions how the Prophet (SAW) will intercede until everyone who has any faith will be saved from Hell.
It is also reported that:
The Prophet (SAW) said: My intercession is for the people who committed the major sins in my Ummah. (Jami Tirmidhi)
This hadith among other evidence also proves that Muslims who commit major sins are not outside the fold of Islam. They are still Muslims and believers.
There are also plenty of hadith that mention people leaving Hell:
The Prophet (ﷺ) said, "Some people will be taken out of the Fire through the intercession of Muhammad they will enter Paradise and will be called Al-Jahannamiyin (the Hell Fire people). (Sahih Bukhari)
Allah's Messenger (ﷺ) said, "The person who will be the last one to enter Paradise and the last to come out of Hell (Fire) will be a man who will come out crawling [...] (Sahih Bukhari)
The rest of the narration isn't relevant, but what is relevant is the concept that people will leave Hell and enter Paradise.
That was some of the evidence that shows that Muslim believers who commit major sins, even if their sins are a lot, will leave Hell and enter Paradise.
The evidence that Hell is eternal for disbelievers is straightforward. There are so many verses in the Quran that it is difficult to count. Allah says:
Indeed, those who disbelieve and commit wrong [or injustice] - never will Allah forgive them, nor will He guide them to a path.
Except the path of Hell; they will abide therein forever. And that, for Allah, is [always] easy. (4:168-169)
This is especially for disbelievers meaning those who commit kufr or shirk. Allah uses the terms "khalideena" here which means "staying forever" and it is the same words used for the people of Jannah.
Hast thou not seen how those who were given a portion of the Scripture are called to the Scripture of Allah (in their disputes) that it may judge between them; then a faction of them turn away, being opposed (to it)? (23) That is because they say: The Fire will not touch us save for a certain number of days. That which they used to invent hath deceived them regarding their religion. (24)