Growing antibiotic resistance complicates H. pylori eradication, posing a public health challenge. Inconclusive research on sociodemographic and clinical factors emphasizes the necessity for further investigations. Hence, this study aims to evaluate the correlation between demographic and clinical factors and the success rates of H. pylori eradication. A group of 162 H. pylori-positive patients were allocated randomly to receive either a ten-day moxifloxacin-based triple therapy or a levofloxacin-based sequential therapy. Eradication success was determined through the stool antigen test. Logistic regression analysis was utilized to figure out potential factors that contribute to H. pylori eradication success. Significantly higher H. pylori eradication rates were observed in the middle age group (COR: 3.671, p = 0.007), among females (p = 0.035), those with BMI ≥ 25 (COR: 2.011, p = 0.045), and non-smokers (COR: 2.718, p = 0.018). In multivariate analysis, age and smoking emerged as significant predictors (p < 0.05). Patients with comorbidities, excluding diabetes and hypertension (COR: 4.432, p = 0.019), dyspepsia (COR: 0.178, p < 0.001), and moxifloxacin triple therapy (COR: 0.194, p = 0.000), exhibited higher chances of eradication (p < 0.05). Further research is vital for tailored approaches to enhance eradication success.