Previous research has shown that many social animals follow the gaze of other individuals. However, knowledge about how this skill differs between species and whether it shows a relationship with genetic distance from humans is still fragmentary. In the present study of gaze following in great apes, we manipulated the nature of a visual obstruction and the presence/absence of a target. We found that bonobos, chimpanzees, and gorillas followed gaze significantly more often when the obstruction had a window than when it did not, just as human infants do. Additionally, bonobos and chimpanzees looked at the experimenter's side of a windowless obstruction more often than the other species. Moreover, bonobos produced more double looks when the barrier was opaque than when it had a window, indicating an understanding of what other individuals see. The most distant human relatives studied, orangutans, showed few signs of understanding what another individual saw. Instead, they were attracted to the target's location by the target's presence, but not by the experimenter's gaze. Great apes' perspective-taking skills seem to have increased in the evolutionary lineage leading to bonobos, chimpanzees, and humans.