Is it Better to Pray Night Prayer or Seek Knowledge?
Sh. al-ʿUthaymīn رَحِمَهُ اللهُ said, “Seeking knowledge is better than night prayer because seeking knowledge, as Imām Aḥmad said, nothing equals it for the one who corrects his intention, in that he intends through it to lift ignorance from himself and from others. Thus, if a person stays awake in the first part of the night to seek knowledge seeking the Face of Allāh, whether he be studying or teaching people, then indeed it is better than night prayer. If it is possible for him to combine both matters then that is better.
However, if the two matters clash with each other, seeking knowledge of the Sharīʿah is better and more deserving. This is why the Prophet ﷺ commanded Abū Hurayrah that he pray Witr before sleeping. The scholars say the reason for that is because Abū Hurayrah would memorise the aḥādīth of the Prophet ﷺ in the first part of the night and sleep in the latter part of the night, so the Prophet ﷺ directed him to pray Witr before he sleeps.”
Majmūʿ al-Fatāwá (14: 113, no. 751).