This longitudinal study of gay men examined safer sex within steady relationships and assessed whether relationship quality influenced safer sex with casual partners. The theoretical frameworks of Rusbult's (1980) investment model of romantic relationships and of Ajzen's (1988, 1991) model of planned behavior were used. Unprotected intercourse with a steady partner was practiced significantly more often when both partners in a steady relationship were seronegative and had an explicit agreement to keep it safe with casual partners. However, there was no indication that explicit agreements reduced the occurrence of unsafe extrarelational sex. Both the investment model of romantic relationships and the model of planned behavior were successful in accounting for sexual risk behavior outside the relationship.