In the name of Allah, Most Gracious, Most Merciful
You might say, “I committed many sins, and I have repented, but my sins pursue me and I am haunted by what I have done. My memories disturb my sleep and do not let me have any rest. How can I free myself ?”
My advice to you is that these feelings are evidence of your sincere repentance. This is essentially remorse, and remorse is repentance. But you can look at your past with hope, the hope that Allah will forgive you. Do not despair of the mercy of Allah, for He says, “And who despairs of the Mercy of his Lord except those who are astray ?” (Al-Hijr 15:56)
Ibn Mas`ud (may Allah be pleased with him) said, “The gravest of major sins are to associate partners with Allah, to feel secure against the plan of Allah and to despair of the mercy of Allah.” (`Abd Al-Razzaq)
In the process of moving towards Allah, the believer is always motivated by both fear of Allah and hope of His mercy. One or other of them may prevail at times of need. If he sins, the fear of Allah overwhelms him, and so he repents. When he repents, the hope of Allah’s mercy fills his heart and he seeks the forgiveness of Allah.
Always remember what Allah -swt- says in the Holy Qur’an:
“إِنَّ اللَّهَ لَا يَغْفِرُ أَن يُشْرَكَ بِهِ وَيَغْفِرُ مَا دُونَ ذَٰلِكَ لِمَن يَشَاءُ ۚ “
”Surely, Allah does not forgive associating anything with Him, and He forgives whatever is other than that to whomever He wills…“(Al-Nisa 4:48)
Never give up on hope and always trust in the mercy of Allah subhanaho wa ta’ala.