The one who commits a sin then repents sincerely will be in a better state after repenting than he was before he committed the sin
Question

Someone committed a major sin when he was young, and he has repented from it and hopes that his repentance was sincere and will be accepted by Allah, because of what he felt in his heart of regret and remorse. But he often wonders whether it is possible that Allah, may He be glorified and exalted, will regard him as equal to one who did not fall into major sin throughout his life, because he feels that he is of lower standing than others.
Praise be to Allah.Allah has created people to obey Him and worship Him, and He has forbidden them to disobey Him and go against His commands. He has commanded them, if one of them falls into sin, to hasten to repent to Allah and not to despair of Allah’s mercy, and He has promised them an abundant reward for repenting.
No matter what sins a person has committed, if he then repents sincerely to Allah and begins to obey Him, Allah will turn to him in mercy, expiate his bad deeds, raise him in status and turn his bad deeds into good deeds, and his state after repenting will be better than it was before he committed the sin, because repentance erases the sins that came before it and the one who repents from sin is like one who did not commit sin at all.
Allah, may He be exalted, says (interpretation of the meaning):
“And those who do not invoke with Allah another deity or kill the soul which Allah has forbidden [to be killed], except by right, and do not commit unlawful sexual intercourse. And whoever should do that will meet a penalty.
Multiplied for him is the punishment on the Day of Resurrection, and he will abide therein humiliated –
Except for those who repent, believe and do righteous work. For them Allah will replace their evil deeds with good. And ever is Allah Forgiving and Merciful” [al-Furqaan 25:68-70].
It was narrated that Anas (may Allah be pleased with him) said: The Messenger of Allah (blessings and peace of Allah be upon him) said: “Allah rejoices more over the repentance of His slave than one of you if he wakes up and finds his camel which he had lost in the wilderness.” Narrated by al-Bukhari (5950) and Muslim (2747).
Ibn al-Qayyim (may Allah have mercy on him) said:
This rejoicing of Allah at the repentance of His slave – even though there is no similar report concerning any other act of obedience – is indicative of the high status of repentance and its virtue before Allah, and indicates that worshipping Allah by repenting is one of the noblest of acts of worship. It indicates that the one who does it becomes better than he was before that.
End quote from Tareeq al-Hijratayn (p. 244).
The companions of our Prophet (blessings and peace of Allah be upon him), who were the most righteous of this ummah, with the deepest knowledge, the most guided, the best in status, had been followers of disbelief and shirk; some of the greatest of them had shown the greatest enmity towards the Messenger of Allah (blessings and peace of Allah be upon him). Yet despite that, when Allah blessed them with faith in Him, caused them to repent to Him and to accompany His Prophet, they became the best and noblest of people, and became better than those who came after them and had never associated others with Allah (shirk).
Undoubtedly shirk and disbelief are the greatest of sins, but through repentance, faith and righteous deeds, Allah forgives sins, expiates bad deeds, and raises people in status.
Shaykh al-Islam Ibn Taymiyah (may Allah have mercy on him) said:
Sins detract from faith, but if a person repents, Allah loves him and his status may rise as a result of repentance. Whoever is guided to repent will be as Sa‘eed ibn Jubayr said: A person may do a good deed and enter Hell because of it, and a person may do a bad deed and enter Paradise because of it. That is, if he does a good deed then it is always in his mind and he is filled with self-admiration as a result of it, or if he does a bad deed, then it is always on his mind [and feels remorse because of it] so he seeks Allah’s forgiveness and repents to Him from it.
End quote from Majmoo‘ al-Fatawa (10/45).
He also said:
When a person repents sincerely and Allah accepts it, He will raise him in status until he becomes greater than he was before, as one of the early generations said: If repentance were not the dearest of things to Him, He would not test with sin the dearest of people to Him.
End quote from Majmoo‘ al-Fatawa (10/293).
He also said:
Adam repented and turned to Allah, and he and his wife said: “Our Lord, we have wronged ourselves, and if You do not forgive us and have mercy upon us, we will surely be among the losers” [al-A‘raaf 7:23]. So Allah turned in mercy to him; He chose him, guided him and sent him down to earth to strive therein in obedience to Him. Thus Allah raised him in status thereby, and so his admittance to Paradise will be with a higher status than before. So whoever among the descendants of Adam commits a sin, then follows the example of his father Adam by repenting, will be blessed, and if he repents, believes and does righteous deeds, Allah will turn his bad deeds into good deeds, and after repenting he will be better than he was before he committed sin, like all the pious close friends of Allah.
End quote from Majmoo‘ al-Fatawa (7/383).
Muslim (190) narrated that Abu Dharr said: The Messenger of Allah (blessings and peace of Allah be upon him) said: “I know the last of the people of Paradise to enter Paradise, and the last of the people of Hell to be brought forth from it. (It will be) a man who will be brought forth on the Day of Resurrection, and it will be said: ‘Show him his minor sins, and conceal from him his major sins.’ So his minor sins will be shown to him and it will be said: ‘You did such and such on such and such a day, you did such and such on such and such a day.’ He will say, ‘Yes,’ and he will not be able to deny it, and at the same time he will be afraid that his major sins will be shown to him. Then it will be said to him, ‘In place of every bad deed you will have a good deed.’ He will say, ‘O Lord, I did things that I do not see here.’” And I saw the Messenger of Allah (S) smiling until his molars appeared.
Shaykh al-Islam said:
When he sees his bad deeds turned into good deeds, he will ask to see the major sins that he was afraid would be shown. It is known that his state in this case, when his bad deeds have been turned into good deeds, will be greater than it would have been if he had not committed bad deeds and they had not been turned into good deeds.
End quote from Majmoo‘ al-Fatawa (10/203).
Ibn al-Qayyim (may Allah have mercy on him) said:
I heard Shaykh al-Islam Ibn Taymiyah (may Allah be pleased with him) say: The correct view is that among those who repent, there are some who do not go back to the state they were in before they committed sin, and there are some who do go back to that state, and there are some who go back to a higher level and become better than they were before they committed sin.
He said: This is according to the state of the penitent after he repents, and his level of effort and resolve, his level of caution and his willingness to work hard. If that is greater than it was before he committed the sin, then he will become better than he was before, and of higher status, but if it is the same as it was before, he will go back to being the same as he was, and if it is less than that, he will not go back to the same level, and he will be of a lower status.
What he stated puts an end to any dispute concerning this matter.
End quote from Madaarij as-Saalikeen (1/302).
He also said:
After repenting sincerely, a person will be better than he was before he committed the sin.
End quote from Shifaa’ al-‘Aleel (p. 118).
Shaykh Ibn Baaz (may Allah have mercy on him) said:
There is no sin greater than shirk, but when the mushrik repents, Allah turns to him in mercy and forgives him. So you must repent from what you know you did, and after repentance the matter will be settled.
End quote from Fatawa Noor ‘ala ad-Darb (4/40).
So whoever commits a major sin, then repents sincerely from it, regrets what he did, turns to Allah, gives up disobeying Allah, keeps company with righteous people, stays away from evil people, then persists in that until he dies, Allah will forgive him by His mercy and grace, and He will raise him in status and turn his bad deeds into good deeds; his state after committing sin and repenting will be better and more perfect than it was before that. He will be much better than many of those who did not commit major sin, but they did not hasten to obey Allah as this repentant person did, and his heart was not filled with all kinds of servitude to Allah as this person’s heart was filled with repentance, regret, love of obeying Allah, hatred of disobeying Him, fear of Allah and hope for His pardon and forgiveness.
And Allah knows best.