The cornea is not supplied with blood vessels and so exchanges gases directly with the atmosphere. So how does it breathe during sleep when our eyes are closed?
As you noted, the cornea needs oxygen, yet it's not vascular. It needs to get it's oxygen supply from diffusion. In the daytime, diffusion occurs from air through the tear film covering the cornea.
The cornea spends about a third of it's lifetime under closed lids. At night, the tear film remains intact and is continuously replenished. The inner aspect of your eyelids, called the palpebral conjunctiva, are highly vascularized, with capillaries just below the surface (and accessory tear ducts and tiny mucosal glands to keep it moist).
When you sleep, oxygen (and nutrients) diffuses from the palpebral conjunctival capillaries through the tear film to your cornea.
The blood vessels in the palpebral conjunctiva are more permeable than most other capillaries and contribute fluid and nutrients to tears by leaking plasma. The surface epithelial cells are also a source of tear fluid because of a special arrangement of the cells such that there is more intercellular space allowing fluid, antibodies, and other plasma constituents to the surface of the conjunctiva.
This very issue was of great concern to ophthalmologists when people started wearing extended-wear contact lenses.
The Conjunctiva and Lacrimal System (www.eyecalcs.com/DWAN/pages)
Organization of Capillaries in the Primate Conjunctiva
The Conjunctiva—Structure and Function (oftalmologia/enciclopedias)
The oxygen tension and temperature of the superior palpebral conjunctiva
Facts About the Cornea and Corneal Disease (cool article)