Human behavior is the largest source of variance in health-related outcomes, and the increasingly popular online health communities (OHC) can be used to promote healthy behavior and outcomes. We explored how the social influence (social integration, descriptive norms and social support) exerted by online social relationships does affect the health behavior of users. Based on an OHC, we considered the effect of three types of social relationships (friendship, mutual support group and competing group) in the OHC. We found that social integration, descriptive norms and social support (information and emotional support) from the OHC had a positive effect on dietary and exercise behavior. Comparing the effects of different social relationships, we found that the stronger social relationship—friendship—had a stronger effect on health behavior than the mutual support group and competing group. Emotional support had a stronger effect on health behavior than informational support. We also found that the effects of social integration and informational support became stronger as membership duration increased, but the effects of the descriptive norms and emotional support became smaller. This study extended the research on health behavior to the online social environment and explored how the social influence exerted by various social relationships in an OHC affected health behavior. The results could be used for guiding users to make use of online social relationships for changing and maintaining healthy behavior, and helping healthcare websites improve their services.