Garbage cans that have locking handles are probably your best bet, because they also prevent strays from trying to pop off garbage can lids that are less secure.
Spaying your dog will also reduce your dog’s risk for cancer and mammary tumors. [2] X Research source
If you’re not crazy about the idea of looking at a fence all day, or if it’s just simply not a financial possibility for you, you can also try liquid fence. Liquid fence is a spray that you can purchase for just over ten dollars at most home improvement stores. The scents in the spray repel dogs and can therefore create a barrier to your yard without the cost of installing an actual fence. [3] X Research source
Keep in mind that this is not a good choice if you have dogs or other pets of your own. If you let them into the yard, they’ll set off the device and have to deal with those high-pitched sounds themselves.
If you have pets (or kids) of your own, keep in mind that they’ll get sprayed, too, so you might want to try a different option if this is an issue for you.
Keep in mind that depending on the size of your yard, you’ll be able to smell the vinegar after you spray it. You might not want to use this method right before you’re going to be using your yard.
Use very small amounts of pepper for this. However annoying strays are, you don’t want to cause permanent damage to them by leaving out huge mounds of pepper that can burn their noses or mouths.
These traps are generally pretty humane and won’t injure the strays in any way.