62 Never should it be forgotten that perfect chastity is a great gift of God. For this reason Jerome wrote these succinct words, "It is given to those, who have asked for it, who have desired it, who have worked to receive it. For it will be given to everyone who asks, the seeker will find, to the importunate it will be opened." Ambrose adds that the constant fidelity of virgins to their Divine Spouse depends upon prayer. With that fervent piety for which he was noted St. Alphonsus Liguori taught that there is no help more necessary and certain for conquering temptations against the beautiful virtue of chastity than instant recourse to God in prayer.
Source: Sacra Virginitas (Vatican.va)