Finding suitable sleeping sites is highly advantageous but challenging for wild animals. While suitable sleeping sites provide protection against predators and enhance sleep quality, these sites are heterogeneously distributed in space. Thus, animals may generate memories associated with suitable sleeping sites to be able to approach them efficiently when needed. Here, we examined traveling trajectories (i.e., direction, linearity, and speed of traveling) in relation to sleeping sites to assess whether Skywalker gibbons (Hoolock tianxing) use spatial memory to locate sleeping trees. Our results show that about 30% of the sleeping trees were efficiently revisited by gibbons and the recursive use of trees was higher than a randomly simulated visiting pattern. When gibbons left the last feeding tree for the day, they traveled in a linear fashion to sleeping sites out-of-sight (> 40 m away), and linearity of travel to sleeping trees out-of-sight was higher than 0.800 for all individuals. The speed of the traveling trajectories to sleeping sites out-of-sight increased not only as sunset approached, but also when daily rainfall increased. These results suggest that gibbons likely optimized their trajectories to reach sleeping sites under increasing conditions of predatory risk (i.e., nocturnal predators) and uncomfortable weather. Our study provides novel evidence on the use of spatial memory to locate sleeping sites through analyses of movement patterns, which adds to an already extensive body of literature linking cognitive processes and sleeping patterns in human and non-human animals.