Shaykh Abdurrazaq Al-Badr حفظه الله said:
In this context (when one is deluded by his knowledge), mere knowledge doesn’t benefit the individual that possesses it. So the individual shouldn’t be deluded. He shouldn’t say: ‘I have memorized the entire Quran’ or ‘I have memorized the books of Sahih’ or ‘I have memorized all of the texts’ or ‘I have learned such and such’. Don’t be deluded by this! Rather, he should supplicate: O my Lord grant me safety! He should ask Allah the Blessed and Most High to prevent him, raise him, benefit him and to not be deluded by his knowledge. Rather, he should be fearful. He should be fearful of Allah and His punishment and he should hope for salvation and safety. From what has been narrated, in relation to Shaykh Ibn Uthaymin رحمه الله they said that there was an individual sitting behind the Shaykh after Fajr, while the Shaykh was remembering Allah and the Shaykh wasn’t aware he was behind him. So Shaykh Muhammad (Ibn Uthaymin) began to feel drowsy. So he strikes his thighs, saying: O Muhammad! The Fire! O Muhammad! The Fire! He was scaring himself and reminding himself of the Fire.
Similar to this, the individual should warn himself in his heart that there is the Fire and there is punishment and that he will one day stand in front of Allah. He shouldn’t be deluded with his knowledge regardless of what it is, or how abundant it is. Rather, he should continue scaring himself (with Allah’s punishment), asking Allah for firmness, guidance and aid!
Source: https://youtu.be/VA1BERj3WUU