Background Although the effect of obsessive-compulsive disorder (OCD) on sleep is not well-known, recent studies suggest an association between OCD and sleep quality. Aims We aimed to assess sleep quality in children and adolescents with OCD and to seek its association with OCD symptoms and OCD severity. Methods All of the subjects were assessed using DSM 5 and affective disorders and schizophrenia for school-age children - present and lifetime version, which is based on DSM-IV. The Yale-Brown obsessive-compulsive scale and children's Yale-Brown obsessive-compulsive scale were applied to the subjects with OCD. Pittsburgh sleep quality index (PSQI) was used to assess sleep quality, and the Wechsler intelligence scale for children-revised (WISC-R) was used to measure their intelligence levels. Results PSQI total score was significantly higher in patients with OCD (p < 0.001), suggesting that patients with OCD have a significantly worse sleep quality. The presence of somatic disorders was also associated with worse sleep quality (p = 0.040). Sleep quality was not significantly associated with OCD severity (p = 0.152). Among patients with extreme OCD, the 'sleep duration' component of the PSQI was higher than those with moderate or severe OCD (p = 0.019). The patients with 'contamination/cleaning' symptom group had a lower total PSQI score compared with 'symmetry/hoarding' symptom group (p = 0.014). Conclusions The findings of the present study indicate that the sleep quality of children and adolescents with OCD is influenced, and there may be an association between sleep quality and OCD symptoms and severity in these patients.