Moral emotion is thought to have evolved to guide our behavior and control our impulse to achieve immediate rewards, thus serving to enforce pro-social behavior. Guilt, one of the moral emotions, is a social, other-oriented emotion that is experienced primarily in interpersonal situations, although it may also be experienced in non-interpersonal situations. We predicted that the intensity of the sense of guilt would differ depending on the relationship between a witness and the person who performed the antisocial behavior because building a good reputation plays an important role in the evolution of reciprocal altruism through indirect reciprocity. Participants were asked to imagine that they had been observed by a third party while committing five kinds of moral transgression based on moral foundation theory, and to describe the intensity of their sense of guilt when witnessed by parents, a cordial friend, a neighbor, or a stranger. The intensity of guilt was significantly lower when the act was witnessed by a stranger regardless of the moral foundation involved. The effects of the kind of witness, however, differed for each moral foundation. The results support the hypothesis that guilt functions to guide our behavior, to achieve cooperation.