Among primates, the suborder Haplorhini is considered to have evolved a consolidated monophasic sleep pattern, with diurnal species requiring a shorter sleep duration than nocturnal species. Only a few primate species have been systematically studied in their natural habitat where environmental variables, including temperature and light, have a major influence on sleep and activity patterns. Here we report the first sleep study on a nocturnal primate performed in the wild. We fitted seven wild Javan slow lorises (Nycticebus javanicus) in West Java, Indonesia with accelerometers that collected activity data, and installed climate loggers in each individual's home range to collect ambient temperature readings (over 321 days in total). All individuals showed a strictly nocturnal pattern of activity and displayed a striking synchronisation of onset and cessation of activity in relation to sunset and sunrise. The longest consolidated rest episodes were typically clustered near the beginning and towards the end of the light period, and this pattern was inversely related to daily fluctuations of the ambient temperature. The striking relationship between daily activity patterns, light levels and temperature suggests a major role of the environment in shaping the daily architecture of waking and sleep. We concluded that well-known phenotypic variability in daily sleep amount and architecture across species may represent an adaptation to changes in the environment. Our data suggest that the consolidated monophasic sleep patterns shaped by environmental pressures observed in slow lorises represent phylogenetic inertia in the evolution of sleep patterns in humans.