Little research investigates whether sleep mediates the adverse effect of perceived discrimination on health and even less is known about whether sleep quality and sleep duration mediate the relationships in the same fashion. We applied a recently developed mediation analysis approach to a survey administered in 2008 in Philadelphia, PA, that includes 9042 adults. Health was measured with self-rated health, stress, and mental illness. Perceived discrimination was operationalized with self-reported discriminatory experience in two social contexts, namely health care system and housing market. Sleep quality and duration were measured with a five-point Likert scale and the self-reported sleep time at night, respectively. After controlling for one’s demographic, socioeconomic, and health-related characteristics, the mediation analysis quantified how much sleep quality and duration can account for the effect of perceived discrimination on these health outcomes. The key findings are: (a) sleep quality and duration accounted for approximately 15 to 25 % of the adverse effect of perceived discrimination. (b) Sleep quality is more important than sleep duration in mediating the relationship between perceived discrimination and health. (c) The proportion of the effect mediated by sleep differs by the social context where perceived discrimination occurred. It was confirmed that sleep mediates the relationship between perceived discrimination and health and the interventions to improve sleep, particularly sleep quality, should help to attenuate the effect of perceived discrimination on health.