Foraging theory posits that isolation from refuge habitat within a landscape increases perceived predation risk and, thus, suppresses the foraging behavior of prey species. However, these effects may depend fundamentally on resource availability, which could affect prey boldness and can change considerably through bottom-up processes. We conducted a field survey and experiment in a coral reef to test the effects of isolation from refuge habitat (i.e., reef structure) on herbivory by reef fishes and whether these effects depend on resource density. By fitting continuous-time, pure death Markov processes to our data, we found that at both the local and landscape scale distance from refuge habitat reduced herbivory in attractive resource patches of palatable benthic algae. However, our field experiment revealed that higher initial resource densities weakened negative effects of distance from refuge habitat on herbivory. Furthermore, we observed higher bite rates and greater total lengths of herbivorous fishes with greater distance from refuge habitat-responses consistent with higher perceived predation risk. Our results suggest that while the loss or fragmentation of refuge habitat reduces consumer control of resources, greater resource densities can partially counteract this effect by altering landscapes of fear of consumer species. Our findings emphasize the importance of considering the spatial context of species interactions that structure communities.