Protected areas are fundamental for conservation, yet are constantly threatened by illegal activities, such as cattle encroachment and wildlife poaching, which reduce biodiversity. Law enforcement is an essential component of reducing illegal activities. Although necessary, law enforcement is costly and its effectiveness in the field is rarely monitored. Improving ranger patrol efficiency is likely to decrease illegal activity occurrence and benefit biodiversity conservation, without additional resource implications. Using ranger-collected data, we develop a method to improve ranger patrol allocation, targeting different combinations of conservation priorities, and predict that detections of illegal activities can be greatly improved. In a field test in Queen Elizabeth Protected Area, Uganda, we increased detections of illegal activities in some cases by over 250% without a change in ranger resources. This easily implemented method can be used in any protected area where data on the distribution of illegal activities are collected, and improve law-enforcement efficiency in resource-limited settings.