Direct reciprocity facilitates the evolution of cooperation when individuals interact repeatedly. Most previous studies on direct reciprocity implicitly assume compulsory interactions. Yet, interactions are often voluntary in human societies. Here, we consider repeated optional games, where individuals can freely opt out of each interaction and rejoin later. We find that voluntary participation greatly promotes cooperation in repeated interactions, even in harsh situations where repeated compulsory games and one-shot optional games yield low cooperation rates. Moreover, we theoretically characterize all Nash equilibria that support cooperation among reactive strategies, and identify three novel classes of strategies that are error-robust, readily become equilibria, and dominate in the evolutionary dynamics. The success of these strategies hinges on the effect of opt-out: it not only avoids trapping in mutual defection but also poses additional threats to intentional defectors. Our work highlights that voluntary participation is a simple and effective mechanism to enhance cooperation in repeated interactions.