The obligatory prayers end with Isha. The night that follows is the time the Prophet ﷺ prayed the longest — and the time he called the best of all for voluntary prayer:

"… the most excellent prayer after what is prescribed is prayer during the night."

— Sahih Muslim 11636

This prayer is called qiyam al-layl ("standing at night") or tahajjud — the Quran's own word for it:

"And from [part of] the night, pray with it [i.e., recitation of the Quran] as additional [worship] for you; it is expected that your Lord will resurrect you to a praised station."

— Quran 17:79 (Saheeh International)1

Like every voluntary prayer it is recommended, not required.202122

What the Quran says about the night

Some of the earliest revelation was a call to stand at night:

"O you who wraps himself [in clothing], arise [to pray] the night, except for a little — half of it — or subtract from it a little or add to it, and recite the Quran with measured recitation."

— Quran 73:1-4 (Saheeh International)2

And the Quran describes the believers by it:

"Their sides part [i.e., they arise] from [their] beds; they supplicate their Lord in fear and aspiration …"

— Quran 32:16 (Saheeh International)3

"They used to sleep but little of the night, and in the hours before dawn they would ask forgiveness."

— Quran 51:17-18 (Saheeh International)4

When to pray it

Any time after Isha until the start of Fajr counts. But the last part of the night is singled out:

"Our Lord, the Blessed, the Superior, comes every night down on the nearest Heaven to us when the last third of the night remains, saying: 'Is there anyone to invoke Me, so that I may respond to invocation? Is there anyone to ask Me, so that I may grant him his request? Is there anyone seeking My forgiveness, so that I may forgive him?'"

— Sahih al-Bukhari 11457

The Prophet ﷺ was realistic about sleep. Whoever fears they will not wake in the last part of the night should pray Witr before sleeping; whoever is eager to get up should pray it at the end of the night, "for prayer at the end of the night is witnessed (by the angels) and that is preferable."12 He described the prayer most beloved to God as that of the Prophet David, peace be upon him, who slept half the night, prayed a third of it, and slept again for a sixth.9

How it is prayed

There is no fixed number. The basic rule is simple:

"The night prayer is offered as two Rak'at followed by two Rak'at and so on and if anyone is afraid of the approaching dawn (Fajr prayer) he should pray one Rak'ah and this will be a Witr for all the Rak'at which he has prayed before."

— Sahih al-Bukhari 99010

So: pray in pairs — each two rak'ahs exactly like any two-rak'ah prayer — as many as you like, and close with an odd number. The Prophet's ﷺ own habit was eleven, long and beautiful; 'Aisha said he "never exceeded eleven rak'at in Ramadan or in other months."11 He stood so long that his feet swelled, and when asked why, he replied: "Should I not be a thankful slave?"8

Start small. Two rak'ahs before you sleep, or a few minutes before Fajr, is a real night prayer.

Witr: closing the night

Witr ("odd") is the odd-numbered prayer that ends the night's prayer:

"Make witr as your last prayer at night."

— Sahih al-Bukhari 99813

It can be a single rak'ah, three, or more, and the schools differ on its ruling and its exact form — including the qunut supplication said in it. All of that, step by step, is in How to Pray Witr.

Tarawih: the night prayer of Ramadan

In Ramadan the night prayer becomes a community event. The Prophet ﷺ promised:

"Whoever establishes prayers during the nights of Ramadan faithfully out of sincere faith and hoping to attain Allah's rewards (not for showing off), all his past sins will be forgiven."

— Sahih al-Bukhari 3714

He led it in the mosque for a few nights, and the crowds grew each night. On the fourth night he did not come out, explaining afterwards: "I was afraid lest the night prayer (Qiyam) should be enjoined on you and you might not be able to carry it on."15 Years later, 'Umar found people praying in scattered groups around the mosque and gathered them behind a single reciter, Ubayy ibn Ka'b — the origin of the congregational Tarawih prayed in mosques today. Even then he remarked that the prayer people slept through, in the last part of the night, was better.16

Tarawih is prayed after Isha, two rak'ahs at a time, usually with Witr at the end. Many mosques recite a portion of the Quran each night so that the whole is completed over the month. All four schools regard it as an emphasised sunnah, and praying it in congregation as recommended.202122

Many scholars hold that the number is open, since the night prayer has no fixed count.1022 Whichever your mosque prays, pray with them.

Laylat al-Qadr

Somewhere in the last ten nights of Ramadan is the Night of Decree:

"Indeed, We sent it [i.e., the Quran] down during the Night of Decree. And what can make you know what is the Night of Decree? The Night of Decree is better than a thousand months."

— Quran 97:1-3 (Saheeh International)5

The Prophet ﷺ said to look for it "in the odd nights of the last ten days of Ramadan,"17 and that whoever prays on it "out of sincere faith and hoping for a reward from Allah," has all their previous sins forgiven.18 When 'Aisha asked what she should say if she knew which night it was, he taught her this:

The du'a for Laylat al-Qadr 19

اللَّهُمَّ إِنَّكَ عَفُوٌّ كَرِيمٌ تُحِبُّ الْعَفْوَ فَاعْفُ عَنِّي

Allāhumma innaka ʿAfuwwun Karīmun tuḥibbu-l-ʿafwa faʿfu ʿannī

O Allah, You are Pardoning and Generous; You love to pardon, so pardon me.

In short

The night prayer is prayed after Isha and before Fajr — best in its last third — in pairs of two rak'ahs, as many as you can, closed with an odd-numbered Witr. In Ramadan it becomes Tarawih, prayed together in the mosque. It is voluntary, and it is the prayer the Prophet ﷺ loved most after the five. For where it sits among the other voluntary prayers, see Beyond the Five and The Sunnah Prayers.