Habit formation occurs in relation to peer habits and comments. This general principle was applied to gambling abstinence in the context of online self-help forums to quit gambling. Participants in this study, conducted between September 2008 and March 2020, were 161 abstinent and 928 non-abstinent gamblers who participated in online self-help chat forums to quit gambling. They received 269,317 comments during their first 3 years of forum participation. Gamblers had an increased likelihood of 3-year continuous gambling abstinence if they had many peers in the forums. However, they had a decreased likelihood of gambling abstinence if they received rejective comments from the forums. Based on these results, online social network-based interventions may be a new treatment option for gamblers.