Proton pump inhibitors (PPIs) were found to be associated with depression. This study aimed to find the cross-sectional association between recent PPI use and suicidal ideation. Item 9 of Patient Health Questionnaire-9 (PHQ-9) of the US National Health and Nutrition Examination Survey (NHANES) between 2005 and 2018 was used to categorize whether or not the participants had suicidal ideation. The secondary outcome of this study was depression and the scores of the PHQ-9 were used as the depression diagnostic instrument. The study population included 16,881 participants who were over 20 years old. The bivariate Rao-Scott χ2 test showed a significant association between PPI use and suicidal ideation (P < 0.001) and a stronger association was observed between PPIs and depression (P < 0.001). Multiple logistic regression analysis of the education, gender, race and age-adjusted model revealed that the PPI users had a 2.34 (95% CI 1.66–3.31) greater risk of having suicidal ideation than the non-PPI users. Middle-aged participants (40–49 years) showed the greatest number of differences in suicidal ideation between PPI and non-PPI users (P < 0.001). Future research should continue to consider the psychiatric effects of taking PPIs.