No need to kill rats. Poison is awful and dangerous.
Make sure they can't get to any food in your garden. Remove bird feeders. Don't put any cooked food scraps in the compost. Don't feed pets like dogs and cats in the garden. Pick up windfall fruits.
Get some mesh over any holes they seem to be using in fences.
They prefer to run along the edges of gardens where they are safest, so move pots, toys etc so they feel more exposed and can't shelter behind things.
Remember to keep house doors closed and open top windows only. Check for access gaps to house like pipework, vents etc. You don't want them visiting you indoors.
Rats don't like strong smells. Peppermint oil or other strong essential oils can be dripped onto pebbles or pieces of wood in places you think they might enter or shelter in. When my daughter had rats coming into an inner city garden, we stopped them by putting cheap gel air fresheners in corners and gappy fence. They were effective for weeks, even after rain.
Rats also hate noise and activity. Bash your compost bin with a stick occasionally (stand well back, just in case). I've heard of people leaving a radio on in allotment sheds to keep rats away.
Just make them really unwelcome and they will probably go out if their way to avoid your garden.