This study evaluated the role of attentional shifting in children's prosocial behavior with peers. Participants were 27 aggressive/rejected and 27 nonaggressive/popular kindergarten and first grade boys and girls. Children's ability to shift attention from one affective state to another was assessed during: (a) a computerized task that required shifting attention between different affective events (i.e., the Children's Attentional Shifting Task, CAST) and (b) an analogue entry task with unacquainted peers. Children's latency for sharing with peers was assessed after they experienced failure during the entry task. Aggressive/rejected children had significant difficulty shifting attention from negative to positive affect during the CAST and were slower to share after experiencing entry failure. In general, aggressive/rejected children were less able to regulate their behavior effectively after experiencing social failure. Girls, regardless of status, had less difficulty than boys shifting attention from one affective state to another during the CAST. In addition, children's social status/aggressiveness, their ability to regulate emotional behavior after social failure and to shift attention effectively on the CAST predicted approximately 31% of the variance in their latency to share. These findings suggest that the ability to shift attention between different affective states plays a significant role in children's prosocial behavior with peers.