Some killing is unavoidable. To exist is to kill. Gardening involves killing, walking often involves crushing little creatures underfoot. Eating involves much killing (all diets, though some more than others). That does not mean, though, that one has to just throw up one's hands and not bother. One can still minimize impact, certainly avoiding any wanton killing and trying one's best to avoid killing from heedlessness.
Every life form is precious and we can try to be as gentle and loving to creatures as possible. Sometimes the issue is just in our mind - we are unwilling to share space with another creature or bug - it's useful to reflect on what hidden view it is that motivates us to refuse to share "my" space with another creature that doesn't understand anything about property rights. I've chased hundreds of lizards out of my dwellings until the act of chasing an adolescent out of the room (the only home he'd ever known since he was born) into the cold dark night made me realize he was not doing anything at all to me and now is suffering due to my basis-less intolerance. I tried to invite him back in and have stopped chasing them out. Other examples of things arising purely from our mind are some hard-to-explain aversions of some bugs etc. Being willing to look at our minds shows us much.
In other instances, co-existence is simply not possible. Examples include mosquitoes that don't just share space with you, bugs leaving droppings that can lead to disease etc or some other infestation that is unaffordable. In those cases, prevention (like Sankha's suggestion) by maintaining cleanliness, not letting them get in the first place, catching them with nets and releasing them outside are solutions.
But sometimes we need to get them out first before implementing preventative measures to stop them from coming back. Remember that what is "unavoidable killing" really depends on how much effort we are willing to put in. To illustrate, the roaches can always run and hide among things when we chase them out instead of nuking them with insecticides. However, if we took care to remove all the things from our dwelling first, it would be possible to not kill any. Not suggesting that that's the only way, just illustrating the flexibility of what "unavoidable" can mean.
So, I would try as much as I reasonably can (that goes far) with mettā for the creatures and if there are accidental deaths, forgive yourself for mistakes since you are trying your best. Then, for chemicals, I would use repellents instead of killing chemicals.
Finally, it's useful to consider all the other ways in which we kill (directly and indirectly) through our choices of what's consumed, what's worn and what's eaten. We can try to be kind to beings in all those areas and gain much mileage rather than being too harsh on oneself because of being unable to prevent avoid 100% in any one particular situation. To come back to the beginning - total avoidance is impossible, but we can do our best.