Start with healthy plants, give them enough water and fertilizer to get them growing well, and the result is a pest-free plant, usually. Even slugs seem to go for the weak and newly transplanted. Not a guarantee, of course, and there are locally obnoxious insects that will snack on anything, but your best bet is to keep your plants happy.
People are more vulnerable to disease when weak or stressed and the same goes for plants. Drought can leave trees open to attacks by insects as well, which doesn't mean you have to pour on the water. Give permanent plantings lots of water when the leaves and flowers are opening and taper off toward the end of summer to increase winter hardiness. And always water deeply, at least a foot, but less frequently. Perhaps no more than once a month, depending on the species.
Then there are the deer, pests of a different sort, and the subject of this post.