Serum melatonin was significantly negatively correlated with ZO-1, LPS and CRP, and then mediated analysis determined that melatonin was a mediator in the relationship between AHI and ZO-1, LPS in moderate-to-severe OSA patients. This evidence concerns the gene TJP1 and obstructive sleep apnea syndrome.