Studies have reported associations between proton pump inhibitor (PPI) use and dementia. However, data are lacking on long-term PPI use and cognitive function. We therefore examined associations between PPI use and performance in tests of cognitive function. Because of shared clinical indications, we examined associations for H2 receptor antagonists (H2RAs) as a secondary aim.