Answer
(Fatwa: 280/280=M/1429)
The way to ask for forgiveness is that first you should perform two rakat صلاة التوبه. Then you should express much remoarse and penitence while remembering your sin, confess your guilt before Allah Almighty and seek forgiveness from Allah with firm determination to refrain from the sin. You should keep away form her you did the sin with. If it is possible, you should give sadqah (charity) and do good deeds which may be compensation for the committed sin.
Allah (Subhana Wa Ta’ala) knows Best
Darul Ifta,
Darul Uloom Deoband