When the Messenger of Allaah -sallAllaahu alayhi wa sallam-would enter the Masjid he would say:

أَعُوذُ بِاللَّهِ الْعَظِيمِ وَبِوَجْهِهِ الْكَرِيمِ وَسُلْطَانِهِ الْقَدِيمِ مِنَ الشَّيْطَانِ الرَّجِيمِ

– I seek refuge with Allaah The Supreme and with His Noble Face, and His eternal authority from the accursed shaytaan –

A’outhu bil-lahil ‘atheem, wa bi-wajhihil-kareem, wa bi-sultanihil-qadeem min ‘ash-shayanir-rajeemi

Then he said: if he says this supplication then the shaytaan says: this person has been protected from me for the rest of the day.

Hadeeth taken from ‘Saheeh al-Kalima at-Tayyib’, By Shaykhul Islaam Ibn Taymeeyah , Checked by Muhammad Nasir-rudeen al-Albani