Abstract As participation in virtual community becomes popular, it is important to know how to encourage individuals to contribute actively and assist other members share their expertise. Through the lens of organizational citizenship behavior (OCB), we explored the factors that facilitate voluntary knowledge sharing in a virtual community. We examined OCB in online gaming communities in which various behaviors can contribute to the community (the team) or to individuals (team members). Our aim was to gain insight into ways of creating an environment that facilitated voluntary sharing of knowledge. Our findings suggested that effective leader–member exchange relationships, the attractiveness of the group to individuals, and affection similarity were important in establishing a virtual environment within which voluntary contributions could be promoted effectively. In addition, our study suggested that better quality leader–member exchange relationships and positive affection toward the virtual team enhanced OCB.