Background: Currently, the Internet is widely used by students for academic purposes; however, excessive Internet use might have negative consequences on students’ academic performance, sleep quality, and cognitive abilities. Objectives: This study aimed to investigate the relationship between Internet usage, sleep quality, and cognitive function among medical students. Methods: This analytical cross-sectional study was conducted on 525 pre-internship medical students, including 304 first- and second-year students, 113 third-year students, and 108 externs, within 2019 and 2021 at Mashhad University of Medical Sciences, Mashhad, Iran. The participants were selected using a stratified sampling method. All participants completed the Cognitive Ability Questionnaire (CAQ), Internet Addiction Questionnaire (IAQ), and Pittsburgh Sleep Quality Index (PSQI). Data were analyzed using SPSS software (version 22). Results: According to the IAQ, 430 participants (81.9%) were categorized as average Internet users, 94 participants (17.9%) had occasional or frequent problems, and 1 participant had significant problems with Internet use. Mean PSQI and CAQ scores were significantly higher among participants with occasional or frequent problems/significant problems than the average Internet users (P < 0.001 each). The total IAQ score showed a positive correlation with total CAQ (r = 0.439, P < 0.001) and total PSQI (r = 0.264, P < 0.001) scores. Among the PSQI subscales, sleep latency (P = 0.032), daytime dysfunction due to sleepiness (P < 0.001), sleep efficiency (P = 0.001), and overall sleep quality (P < 0.001) were worse in participants with occasional or frequent problems/significant problems than in average Internet users. Conclusions: Excessive Internet use negatively affects the sleep quality and cognitive performance of medical students.