To keep coyotes out of from your yard, make sure that no food, including pet food, is waiting for them. Keep garbage cans closed all the time, and make sure that coyotes can't open them or trip them over. Get rid of all the rodents in the yard, as they attract coyotes. Don't let fruit lie on the ground in the yard.
Install a wire mesh fence that is at least 5 feet tall all around your yard to keep coyotes away. Make sure that coyotes can't dig under the fence, and install rollers on top of the fence to prevent them from climbing over it. You can also install motion-sensor lights or sprinklers in the yard, as coyotes don't like loud noises and bright, flashing lights.
If you encounter a coyote, the best strategy is to scare it away by yelling, waving and clapping your hands, jumping up and down, or throwing something towards the coyote without hitting it. Spraying coyotes with a garden hose, some vinegar water or pepper spray can also make coyotes go away. Continue scaring them away until they leave your sight completely. Never run away from a coyote or turn your back on one.