A method is disclosed for treating bedbug infestations, that involves filling the lower portions of the void spaces inside a wall with a thick and stable foam, to form a foam barrier inside the walls, allowing the foam barrier to collapse over time to coat portions of the interior of the wall with residual foam. The foam may contain a non-repellant pesticide, but certain foams are effective in treating bedbugs even if the foam does not contain any pesticide.