The perfect conductivity problem concerns optimal bounds for the magnitude of an electric field in the presence of almost touching perfect conductors. This reduces to obtaining gradient estimates for harmonic functions with Dirichlet boundary conditions in the narrow region between the conductors. In this paper we extend estimates of Bao-Li-Yin to deal with the case when the boundaries of the conductors are given by graphs with arbitrary vanishing orders. Our estimates allow us to deal with globally defined narrow regions with possibly non-trivial topology.We also prove the sharpness of our estimates in terms of the distance between the perfect conductors. The precise optimality statement we give is new even in the setting of Bao-Li-Yin.