Someone asked Hadhrat (Maulana Ashraf ‘Ali Thanwi) for a cure for staring at non-mahram (unrelated) women. Hadhrat (ra) said,

”there is no remedy except courage and bearing the inconvenience of not staring. What helps this is (a) the thought of the relevant punishment and (b) making lots of dhikr.

Discourses of Hadhrat Maulana Muhammad Ashraf Ali Thanavi (RA), Islamic Promotions, Page 46