This study aims to examine whether perceived poor sleep quality predicts subsequent recurrence of peptic ulcer disease (PUD) in older patients with mild cognitive impairment following Helicobacter pylori eradication and to investigate whether social engagement status alters this association. Of 1,689 older patients with H. pylori-infected PUD recruited from eight Grade-A hospitals in the People’s Republic of China between 2011 and 2014, H. pylori was eradicated and PUD cleared in 1,538 patients by the end of 2014; 1,420 of these were followed for up to 36 months. The Kaplan–Meier method was used to compare the proportion of PUD recurrence, as confirmed with esophagogastroduodenoscopy, among older patients with different levels of sleep quality and social engagement statuses. Multivariate Cox-proportional hazards models were performed to examine the association between sleep quality and PUD recurrence, and the role of social engagement in altering this relationship. The results showed that PUD recurrence was more prevalent in poor (10.8%) compared with good sleepers (5.5%). However, increased and continued social engagement reduced the proportion to 7.2% and 8.2% among poor sleepers, respectively. Poor sleep quality was associated with subsequent PUD recurrence (hazard ratio [HR] 1.965 (1.002, 3.518)). However, no significant difference was observed between good and poor sleepers who reported increased (HR 1.428 (0.736, 2.380)) and continued (HR 1.273 (0.915, 2.492)) social engagement, suggesting that increased and continued social engagement prevented the effect of poor sleep quality on PUD recurrence. To conclude, poor sleep quality is associated with subsequent PUD recurrence. However, increased and continued social engagement may moderate this association.