Ibn-e-Anas has mentioned in his book and Hakim has mentioned in Mustadarak in Sahib-e-Fasal-e-Hasees that the person who has pain in his eye should recite this prayer
[ اَللّٰھُمَّ مَتِّعْنِیْ بِبَصَرِیْ وَاجْعَلْہٗ الْوَارِثَ مِنِّیْ وَاَرِنِیْ فِی الْعَدُوِّ ثَأْرِی وَانْصُرْنِیْ عَلٰی مَنْ ظَلَمَنِیْ ]
TRANSLATION: "Oh Allah! Keep my eyesight safe, and give me benefit and make me its inheritor. And take my revenge from the enemy and help me against the oppressor."
The scholars have mentioned that whoever has some kind of dust in his eyes he should recite this ayat of the Quran 3 times after every prayer and blow on the eyes.
فَکَشَفْنَا عَنْکَ غِطَآءَکَ فَبَصَرُکَ الْیَوْمَ حَدِیْدٌ . (Qaaf 22)