Background Drug addiction can lead to suicidal ideation or suicide attempt so that half of those who attempt suicide have a history of substance abuse. The purpose of this study was to investigate the effect of educational intervention based on Theory of Planned Behavior (TPB) on reducing suicidal ideation and suicide attempt of addicts. Methods A longitudinal quasi-experimental educational intervention was conducted on 200 methadone-treated addicts with suicidal ideation under the auspices of government addiction centers of Shiraz city from 2021 to 2022. Baseline data on demographic characteristics, suicidal ideation, and TPB questionnaire were collected from two groups at the beginning of the study and then three months after the intervention. The experiment group received educational intervention including sessions of individual and group counseling, training and organizational supports. The questionnaire was completed by both the experimental and control groups before the educational intervention and three months after the educational intervention. Data were analyzed using SPSS 22 software through independent t-test, Chi-square and paired t-test (p = 0.05). Results The mean age of addicts in the experimental and control groups was 38.80 ± 11.64 and 39.41 ± 11.18 years, respectively (p = 0.206). 22% of the experimental group and 18% of the control group had a history of suicide. According to the results, there was no significant difference between the experimental and control groups in terms of knowledge, attitude, subjective norms and perceived behavioral control before the educational intervention, however, the mentioned variables increased significantly in the experimental group three months after the educational intervention. There was no significant difference in suicide attempt and suicidal ideation between the experimental and control groups before the educational intervention, however, there was a significant change in the experimental group after the educational intervention. Conclusion The results of the present study showed the effect of educational intervention on the knowledge, attitude, subjective norms, perceived behavioral control, suicidal ideation and suicidal attempt of addicts, thus confirming the effectiveness of the TPB-based intervention on reducing suicide of addicts.