Disruption of nocturnal sleep in an intensive care unit may remarkably affect production of melatonin, which is also known to have anti-inflammatory properties. In the present study, we aimed to investigate the effect of sleep quality on melatonin levels and inflammation after surgery. Thus, we compared the patients, who were screened in the side-rooms where the lights were dimmed and noise levels were reduced, with the patients who received usual care. Preoperative and postoperative urine 6-sulphatoxymelatonin, serum interleukin-1 (IL-1), interleukin-6 (IL-6), and c-reactive protein (CRP) levels were measured and data on sleep quality was collected using the Richards-Campbell Sleep Questionnaire. Postoperative CRP and IL-6 levels were greater in the control group than in the experimental group, whereas postoperative 24 h melatonin levels were greater than preoperative levels and the difference was steeper in the experimental group in concordance with sleep quality scores. Thus, the regulation of light and noise in ICUs may help the recovery after major surgeries in patients, potentially by increasing melatonin production, which has anti-inflammatory properties.