Background: Medical ethics deals with the ethical obligations of doctors to their patients, colleagues and society. The annual reports of Sri Lanka Medical Council indicate that the number of complaints against doctors has increased over the years. We aimed to assess the level of knowledge, attitude and practice regarding medical ethics among doctors in three teaching hospitals in Sri Lanka. Methods: A hospital-based cross-sectional study was conducted among doctors (n = 313) using a pre-tested selfadministered, anonymous questionnaire. Chi Squared test, and ANOVA test were used to identify the significance of association between level of knowledge and selected factors. Results: Most doctors (81.2%) had a poor level of knowledge on medical ethics, with postgraduate trainees showing significantly (p = 0.023, Chi square) higher level of knowledge. The average knowledge on medical ethics among doctors was significantly different between the three hospitals (p = 0.008, ANOVA). Over 95% had a favourable attitude towards gaining knowledge and advocated the need for training. The majority (69.3%) indicated awareness of unethical practices. 24.6% of respondents stated that they get a chaperone 'sometimes' during patient examination while 3.5% never do. The majority (54%) responded that they never accept gifts from pharmaceutical companies in recognition of their prescribing pattern. 12-41% of doctors participated in the study acknowledged that they 'sometime' engaged in unethical practices related to prescribing drugs, accepting gifts from pharmaceutical companies and when obtaining leave. Conclusion: Most doctors had a poor level of knowledge of medical ethics. Postgraduate trainees had a higher level of knowledge than other doctors. The majority showed a favourable attitude towards gaining knowledge and the need of training. Regular in-service training on medical ethics for doctors would help to improve their knowledge on medical ethics, as well as attitudes and ethical conduct.