Imaam Ibn Al-Qayyim (Rahimahullaah) said:
“And the cure for this deadly illness (i.e. love before marriage) is for the person that is afflicted to realize that this love is only due to his/her own delusions and ignorance..
So upon such a person is to first and foremost strengthen their Tawheed and reliance upon Allaah, and secondly to increase in worship and busy themselves with it, so much so that they do not have any spare time letting their minds wander and think about their beloved.
And they should call upon Allaah to protect them and save them from this evil, just as Prophet Yusuf called upon Allaah and he was saved. And they should do as he did, be as he was, in terms of ikhlaas (sincerity) and remembering Allaah in abundance.
This is because if the heart is filled with ikhlaas for the sake of Allaah, there will be no space left for any unlawful love to be present, rather this only happens to a heart that is empty and has no ikhlaas whatsoever.
And let such people remind themselves that whatever Allaah has decreed for them is only in their own best interests, and when Allaah commands something it is never to cause harm or misery to His slaves.
And let them also remind themselves that their unlawful love does not benefit them, neither in this world or the hereafter! As for this world then they will be so preoccupied with their love that it will cripple them and will cause them to live in a fantasy world. And as for the hereafter then it will cause them to be preoccupied with the love of the creation instead of love for the Creator!
These people need to be reminded, that the one who is emerged in something will never see its ill effects, neither will the person who has never experienced such things. The only people who will be able to relate to them are those who have experienced the same thing but have been saved. Such people can look back and realize how evil it is.”
[ad-Daa’ wa ad-Dawaa p. 300]