One of the best ways to keep pests out of your yard is to build exclusion fences around the perimeter. Fencing contractors can install everything from chain link to vinyl to iron, protecting your yard, children, and pets from pests that could eat your plants and attack small beings. What you do depends on what you're dealing with, and your fence contractors can help you figure out a good solution.
For Those That Dig Under
On your side of the fence, have the contractors who are installing the fence place netting or chain link material along the bottom, and have them dig several inches down so that the fencing material blocks anything that could burrow through soil to get to your yard. Ideally you'd want the material to curve outward (away from your yard) so that the animal can't even get a few inches down. But if the land outside the fence is part of someone else's backyard, you can't really to that.
For Those That Jump Over
Cities and counties often have height maximums for fences, so if you can't raise the height of the fence, you have three options. One, if the pest in question needs to use the top of the fence to jump over, is the coyote roller. This is a tube placed on a horizontal rod across the top of each section of the fence. When the animal tries to place its front paws on the top of the fence to help it scramble over the fence, the roller will cause it to fall back to the ground.
If the fence has to remain low, making it easy for anything to leap over without assistance, you may want to plant nonedible small trees all around the inside of the fence. That should block most animals from jumping over.
For animals dropping down from a neighbor's tree that's overhanging the yard (like squirrels), there's not much you can do except talk to the neighbor about contacting pest control or setting up scare tactics geared toward the animal in question. Keep in mind these animals are hard to control.
Please, though, avoid using fences that have sharp iron tips pointing up, especially if the pest in question is deer. Deer have been known to misjudge their jumps and impale themselves on sharp-tipped iron fences.
For Those That Sneak Through
If you're installing a solid fence, inspect it weekly when you do your yard work to see if the panels are showing signs of wear or of being breached. Have the fence contractors come back to fill in worn spots and holes to keep out smaller pests that are trying to squeeze through.
Your fence can provide some great pest control if you prepare it correctly and install extras like the rollers. While it might not keep all pests out of your garden, it can certainly reduce what you have to deal with. Fence installers can help you choose a style that is easier to fortify against whatever pests you're dealing with.