Allah (SWT)'s order in the Quran to stay away from Zina. "And those who invoke not any other god along with Allah, nor kill such life as Allah has forbidden, except for just cause, nor commit illegal sexual intercourse (zina) and whoever does this shall receive the punishment. The torment will be doubled to him on the Day of Resurrection, and he will abide therein in disgrace; except those who repent and believe and do righteous deeds, for those Allah will change their sins into good deeds, and Allah is Oft Forgiving, Most Merciful." (al-Furqaan #25, ayat #68-70) "And come not near to unlawful sexual intercourse. Verily, it is a faahishah (a great sin) and an evil way." (Sura Al-Israa # 17 ayah # 32)
Hadith warning against not even coming close to Zina
"Some persons from Banu Hisham entered the house of Asma' daughter of Umays when AbuBakr also entered (and she was at that time his wife). He (AbuBakr) saw it and disapproved of it and he made a mention of that to Allah's Messenger (saaws) and said: I did not see but good only (in my wife). Thereupon Allah's Messenger (saaws) said: Verily Allah has made her immune from all this. Then Allah's Messenger (saaws) stood on the pulpit and said: After this day no man should enter the house of another person in his absence, but only when he is accompanied by one person or two persons." (Sahih Al-Bukhari Book 25, Hadith # 5403)
"Abd-Allaah ibn Masood (RAA) said: I asked the Messenger of Allah (SAW), Which sin is worst in the sight of Allah? He said, To make any rival to Allah, when He has created you. I asked, Then what? He said, To kill your child for fear that he will eat with you. I asked, Then what? He said, To commit zinaa with the wife of your neighbour." (Reported in Sahih Al-Bukhaari, Hadith #492 and In Shaih Muslim, Hadith #90).
This refers to the punishment for touching, so how about worse deeds, such as embracing and kissing, and even worse kinds of illicit activity?
Rasulullah (SAW) said, "Whenever a man is alone with a woman the Devil makes a third." (Al-Tirmidhi 3118, Narrated Umar ibn al-Khattab, Tirmidhi transmitted it as authentic) note: So we should always try not to be alone with a woman who is not mahrum to us and not even go close to Zina.
Repentance from Zina
Ibn Abbaas (RAA) said: There is no major sin if one asks for forgiveness, and there is no minor sin if one persists in repeating it.
So if one wants to repent from having made the great sin of Zina he should remember these 4 things..
1) Do not despair, for Allah the Most Exalted and Glorified said in the Quran "Say: Oh my servants who have transgressed against their souls! Despair not of the mercy of Allah, for Allah forgives all sins; for He is oft-forgiving, most merciful." [Surah 39, Verse 53]
2) Let your repentance be truly from your heart, and stay away from all sources of temptations. Also, perform many good deeds, as good deeds abrogate the bad ones.
3) If you repent to Allah, you are no longer described as a fornicator (zaani). Therefore, you can marry a chaste man or woman.
4) The believer has high hope and aspiration for the best from Allah. He not only asks Allah for making his punishment easy in hellfire, but he also prays to Allah the Almighty to save him from Hell and award him with paradise for his repentance and good deeds.