You can use an automatic gate to keep pets from straying.