Very little is known about the comparative long-term effectiveness of novel antipsychotics in relapse prevention, especially in first-episode schizophrenia. Nationwide data from Finnish health care registers were gathered prospectively for all persons with periods of inpatient care due to schizophrenia in Finland during 1972–2014. Altogether 62250 persons were included in the prevalent cohort, and 8719 in the incident (first-episode schizophrenia) cohort. The follow-up for antipsychotic use started at 1996 for the prevalent cohort, and at the first discharge from inpatient care for the incident cases. Within-individual Cox regression models for risk of psychiatric and all-cause hospitalization were constructed to compare risk during antipsychotic use and no use using individual as his/her own control to eliminate selection bias. With follow-up time up to 20 years (median = 14.1, interquartile range = 6.9–20.0), 59% of the prevalent cohort were readmitted to psychiatric inpatient care. Olanzapine long-acting injection (LAI; adjusted hazard ratio = 0.46, 95% confidence interval = 0.36–0.61), clozapine (0.51, 0.49–0.53), and paliperidone LAI (0.51, 0.40–0.66) were associated with the lowest risk of psychiatric rehospitalization in the prevalent cohort. Among first-episode patients, the lowest risks were observed for flupentixol LAI (0.24, 0.12–0.49), olanzapine LAI (0.26, 0.16–0.44), and perphenazine LAI (0.39, 0.31–0.50). Clozapine and LAIs were associated with the lowest risk of all-cause hospitalization in both cohorts. Clozapine and LAIs are the most effective treatments in preventing psychiatric and all-cause hospitalization among chronic and first-episode patients with schizophrenia.