Pick up fruit and vegetables in your yard. Keep lids tight. Use only rodent resistant composters. In basements keep any food in closed containers that rats can't chew through. Cover all openings to your house.
Rats can get into very small places.
Do not leave your pet food outside. If your pet doesn't eat it, the rats will. Roof rats get into your house from tree branches that hand over the roof. Keep trees cut back and cover any openings in the eves. Rats live in sewers and can follow the food in pipes up to your toilet.