1. The ability of pathogens and parasites to adaptively exploit novel hosts has contributed to their unparalleled diversification along the tree of life. Moreover, evolved host-range shifts are of particular applied interest -for instance, zoonotic 'spillovers' towards humans motivate growing concern about emerging infectious diseases. Thus, identifying the constraints upon, and conditions conducive to, host switching by pathogens is critical to addressing pressing public health and agricultural problems, as well as to understand a major driver of biodiversity.2. How do processes that structure host communities (such as among-host competition) set the selective context for the evolution of pathogen host ranges, and how do these processes interact with trade-offs constraining the evolution of a pathogen's ability to exploit its host?3. Here, we develop a theoretical framework to understand how resource competition among hosts interacts with constraints on pathogen biology in driving host shifts. We characterize how antagonistic pleiotropy in the pathogen's ability to exploit hosts can counteract ecological selection towards host-range shifts.4. We find that although the effects of apparent competition on host-range shifts are mediated through the ancestral pathogen's direct and indirect effects on the entire host community, the effects of exploitative competition on host-range shifts are mediated through exploitative competition's effect on the previously unexploited host.5. Finally, we show that even when changes in host community structure create conditions conducive to host switching, a general trade-off between pathogen virulence and burst size can prevent pathogens from evolving seemingly adaptive patterns of host use. We illustrate how these constraints faced by pathogens shape the ecoevolutionary interaction between pathogen evolution and host communities.6. We discuss how our results inform predictions about the kinds of pathogen lineages likely to exhibit host-range shifts, and the role of apparent versus direct competition in structuring host-pathogen communities over evolutionary time.This is an open access article under the terms of the Creative Commons Attribution License, which permits use, distribution and reproduction in any medium, provided the original work is properly cited.