Post-stroke depression (PSD) negatively affects the prognosis of post-stroke animals. Ramelteon has neuroprotection for chronic ischemia animals, but the effect and the biological mechanism of it on PSD is still unclear. This study explored the effects of ramelteon with prophylactic administration on blood-brain barrier in rats with middle cerebral artery occlusion (MCAO) and the oxygen-glucose deprivation/reperfusion (OGD/R) bEnd.3 cells and found that ramelteon pretreatment improved the depressive behaviors and cerebral infarction injury in MCAO rats. Also, this study found ramelteon pretreatment improved viability and inhibited permeability in OGD/R cells. In addition, this study found that MCP-1, TNF-α, and IL-1 levels were raised in the MCAO rats and that occludin protein and mRNA levels were inhibited in the MCAO and the OGD/R models, while the Egr-1 level was up-regulated. All of these were antagonized by ramelteon pretreatment. In addition, this study showed that overexpression of Egr-1 reversed the effect of 100 nM ramelteon pretreatment on FITC and occludin levels in OGD/R cells. In short, this study has demonstrated that the protective effect on PSD of ramelteon pretreatment on MCAO rat is related to the development of BBB permeability and that ramelteon regulates occludin to protect the BBB by inhibiting Egr-1.