Suicide is a leading cause of death in the United States, having increased more than 30% from 2000 to 2018. An inexpensive, safe, widely available treatment for preventing suicidal behavior could reverse this trend. To confirm a previous signal for decreased risk of suicide attempt following prescription fills for folic acid in a national pharmacoepidemiologic study of patients treated with folic acid. A within-person exposure-only cohort design was used to study the dynamic association between folic acid (vitamin B9) prescription fills over a 24-month period and suicide attempts and intentional self-harm. Data were collected from a pharmacoepidemiologic database of US medical claims (MarketScan) for patients with private health insurance who filled a folic acid prescription between 2012 and 2017. The same analysis was repeated with a control supplement (cyanocobalamin, vitamin B12). Data were analyzed from August 2021 to June 2022. Folic acid prescription fills. Suicide attempt or intentional self-harm resulting in an outpatient visit or inpatient admission as identified by codes from the International Statistical Classification of Diseases, Ninth and Tenth Revisions, Clinical Modification. Data on 866 586 patients were collected; 704 514 (81.30%) were female, and 90 296 (10.42%) were 60 years and older. Overall, there were 261 suicidal events during months covered by a folic acid prescription (5 521 597 person-months) for a rate of 4.73 per 100 000 person-months, compared with 895 suicidal events during months without folic acid (8 432 340) for a rate of 10.61 per 100 000 person-months. Adjusting for age and sex, diagnoses related to suicidal behavior, diagnoses related to folic acid deficiency, folate-reducing medications, history of folate-reducing medications, and history of suicidal events, the hazard ratio (HR) for folic acid for suicide events was 0.56 (95% CI, 0.48-0.65), with similar results for the modal dosage of 1 mg of folic acid per day (HR, 0.57; 95% CI, 0.48-0.69) and women of childbearing age (HR, 0.60; 95% CI, 0.50-0.73). A duration-response analysis (1-mg dosage) revealed a 5% decrease in suicidal events per month of additional treatment (HR, 0.95; 95% CI, 0.93-0.97). The same analysis for the negative control, cyanocobalamin, found no association with suicide attempt (HR, 1.01; 95% CI, 0.80-1.27). This large-scale pharmacoepidemiologic study of folic acid found a beneficial association in terms of lower rates of suicide attempts. The results warrant the conduct of a randomized clinical trial with suicidal ideation and behavior as outcomes of interest. If confirmed, folic acid may be a safe, inexpensive, and widely available treatment for suicidal ideation and behavior.