A fence is best. 6ft tall is good. even better is a fence they cannot see through or over.
Sometimes there are codes that get in the way, or there are other reasons why we cannot have a fence.
In lieu of a fence, you might try mixing an egg with a blender of water and using a watering can to sprinkle the mixture over the plants they consume. The short-coming of this method is the need to re-apply after every rainfall.
Or plant landscape plants known for being poisonous, fragrant, or fuzzy.