A recent study concludes that a bit of dim lighting during sleep blocks melatonin release and, interestingly, renders tamoxifen, a widely used breast cancer drug, completely ineffective.
I’m currently reading the excellent book Lights Out! Sleep, Sugar, and Survival by T.S. Wiley and Bent Formby, and the authors echo the exact same point: when we sleep, we need to be in a pitch black room. Absolute darkness. Even the tiniest bit of light—from a charging phone, the crack in the door, a smoke detector—blocks melatonin release and gives us a less-than-ideal sleep.
(Another tip: your room should be kind of cold. Like, sub-70s cold.)