Anas said that the Prophet was accustomed to engage in private devotion in the mosque during the last ten nights of Ramadan; but one year he omitted it and he engaged in it during twenty nights the next year.
Tirmidhi transmitted it, and Abu Dawud and Ibn Majah transmitted it from Ubayy b. Ka'b.
Ibn ‘Umar said that when ‘Umar consulted the Prophet about a vow he had made in the pre-Islamic period to spend a night in devotion in the sacred mosque, he said, “Fulfill your vow.”
‘A'isha said that when God’s messenger intended to engage in private devotion in the mosque he prayed the dawn prayer and then entered his place of seclusion.
‘A'isha said, “During his private devotional exercises God’s messenger would put his head near me when he was in the mosque, and I would comb it; and he entered the house only to relieve himself.”