In J. R. R. Tolkien's fictional universe, the Door of Night was a place set at the utmost West of Arda near the Void. The Door was created by the Valar at the time of the making of the Sun and Moon. It was vital in the cosmology of Middle-earth, forming the border between Arda and the void, as well as being the final prison of the renegade Vala Morgoth Bauglir. Other names of the Door of Night include Moritarnon and Tarn Fui.
The Door was created by the Valar as a gateway for the Sun to pass through. According to others, though, it was made expressly as a gateway through which to expel Morgoth. The following text describes the creation of the Door in the Ainulindale:
Thus came it that the Gods dared a very great deed, the most mighty of their works; for making a fleet of magic rafts and boats with Ulmo's aid - and otherwise had none of these endured to sail upon the waters of Vai - they drew to the Wall of Things, and there they made the Door of Night.
The Sun was to pass through the Door of Night as it travelled above Arda. When the Sun passed through the Door, night would fall upon Middle-earth. The Moon would then rise from its resting place and continue on its path over the Earth. The Sun would traverse the border of the Wall of the World, re-entering the world in the East, at the Gates of Morning. At the same time the Moon would be sinking in the West and a new day would begin. At the conclusion of the War of Wrath, when Eärendil the Mariner sailed to Aman to beseech the aid of the Valar, Morgoth was imprisoned outside the Door of Night at the end of the War of Wrath. The following reference is from the Silmarillion:
"But Morgoth himself the Valar thrust through the Door of Night beyond the Walls of the World, into the Timeless Void; and a guard is set forever on those walls, and Eärendil keeps watch upon the ramparts of the sky."
At the "End of Days" which is referenced to even in The Lord of the Rings by Gandalf, Tom Bombadil, and others, Morgoth shall return as Melkor by breaking the Door of Night, precipitating the Last Battle (Dagor Dagorath).
A description of the location of the Door of Night can be found in The Book of Lost Tales 1:
About the World are the Ilurambar, or Walls of the World. They are as ice and glass and steel, being above all the imagination of the Children of Earth cold, transparent, and hard. They cannot be seen, nor can they be passed, save by the Door of Night. Within these walls the Earth is globed: above, below and upon all sides is Vaiya, the Enfolding Ocean. But this is more like to sea below the Earth and more like to air above the Earth.
The Door of Night was likened to a huge gate of stone at the very edge of the world: the Ilurambar, invisible Walls of the World.
There it still stands, utterly black and huge against the deep-blue walls. Its pillars are of the mightiest basalt and its lintel likewise, but great dragons of black stone are carved thereon, and shadowy smoke pours slowly from their jaws.
In the Book of Lost Tales 1 the fate of the Door of Night in the West and its counterpart the Gates of Morning in the East are documented as follows:
For 'tis said ere the Great end come Melko shall in some wise contrive a quarrel between Moon and Sun, and Ilsinor shall seek to follow Urwendi through the Gates, and when they are gone the Gates of both East and West will be destroyed, and Urwendi and Ilsinor shall be lost.