Although the coffee berry borer (CBB) is the most important coffee pest worldwide, controversies remain regarding basic aspects of its behavior, such as how this is influenced by abiotic factors of the coffee agroecosystem. In this study, we compared the level of infestation and total population per fruit under three different levels of shade (full sun, up to 40%, and >40%), for two varieties of coffee (Caturra and Catimor) and at two different altitudes (1200 to 1700 m above sea level) in Rodríguez de Mendoza, Peru. We found that the infestation percentage increases with the shade levels of the plot. The average percentages of infestation according to shade levels were 10.52% for coffee in full sun, 12.56% with up to 40% shade, and 17.99% for coffee growing in more than 40% shade; however, maximum infestation values of 68.421%, 84.127%, and 95.238% were obtained for coffee plantations in full sun, up to 40% shade, and more than 40% shade, respectively. The Catimor variety was found to be more susceptible to CBB infestation than Caturra. In addition, CBB infestation per fruit was found to decrease with increasing altitude.