Humans are the only primates that make music. But the evolutionary origins and functions of music are unclear. Given that in traditional cultures music making and dancing are often integral parts of important group ceremonies such as initiation rites, weddings or preparations for battle, one hypothesis is that music evolved into a tool that fosters social bonding and group cohesion, ultimately increasing prosocial in-group behavior and cooperation. Here we provide support for this hypothesis by showing that joint music making among 4-year-old children increases subsequent spontaneous cooperative and helpful behavior, relative to a carefully matched control condition with the same level of social and linguistic interaction but no music. Among other functional mechanisms, we propose that music making, including joint singing and dancing, encourages the participants to keep a constant audiovisual representation of the collective intention and shared goal of vocalizing and moving together in time — thereby effectively satisfying the intrinsic human desire to share emotions, experiences and activities with others.