To keep stray dogs away from your backyard, make sure your trash is tightly bagged and canned, and that youre not leaving pet food outside, which can attract dogs. You can also sprinkle black or cayenne pepper around your yard, which dogs dislike. Additionally, try planting marigolds in your yard, as dogs dont like the smell.