Introduction: Self medication especially with analgesics is a common practice among undergraduate medical students. Variation in analgesic self medication prevalence and pattern is often seen due to geographical and target population differences. The mutual influence of pain and sleep quality might persuade students self medication behaviour. Aim: To assess analgesic self medication and its association with sleep quality among the medical undergraduates. Materials and Methods: A cross-sectional questionnaire based study was conducted from December 2015 to February 2016 among 320 medical undergraduates. The information about socio-demographic profile, symptoms, types of analgesics, source of information and reason for analgesic self medication was collected. The sleep quality of students was assessed by Pittsburgh Sleep Quality Index (PSQI). The qualitative variables were expressed as percentages. Odds Ratio (OR) with 95% Confidence Interval (CI) was also calculated. Chi-square test was used. Results: Analgesic self medication prevalence was 49.7%, more prevalence seen among males, seniors, urban residents and students of working parents. Headache (48.4%) was the most common cause and paracetamol (79.7%) was most frequent drug used, based on knowledge obtained through textbook and internet (47.1%). Mildness of symptoms (49.1%) was the most important motivation behind self medication. Analgesic use was more (57.4%) among "poor sleepers" compared to "normal sleepers" (45.2%). Conclusion: Despite having easy accessibility to expert consultations, high prevalence of analgesic self medication among medical students and its association with poor sleep quality is a distressing issue. This indicates an urgent need of awareness programmes about harmful effects of self medication and healthy sleep practices.