Sleep disorder has become a prevalent issue in current society and is connected with the deterioration of neurobehaviors such as mood, cognition and memory. Ellagic acid (EA) is a phenolic phytoconstituent extracted from grains and fruits that has potent neuroprotective properties. This research aimed to study the alleviative effect and mechanism of EA on memory impairment and anxiety caused by sleep deprivation (SD). EA ameliorated behavioral abnormalities in SD mice, associated with increased dendritic spine density, and reduced shrinkage and loss of hippocampal neurons. EA reduced the inflammatory response and oxidative stress injury caused by SD, which may be related to activation of the Nrf2/HO-1 pathway and mitigation of the TLR4-induced inflammatory response. In addition, EA significantly reduced the mortality and ROS levels in glutamate (Glu)-induced hippocampal neuron injury, and these effects of EA were enhanced in TLR4 siRNA-transfected neurons. However, knockdown of Nrf2 dramatically restrained the protective impact of EA on Glu-induced toxicity. Taken together, EA alleviated memory impairment and anxiety in sleep-deprived mice potentially by inhibiting TLR4 and activating Nrf2. Our findings suggested that EA may be a promising nutraceutical ingredient to prevent cognitive impairment and anxiety caused by sleep loss.