A general approach to reduction of the infinite computational domain to a strip or a cylinder is developed for two- and three-dimensional narrow-angle diffraction problems. Our method is based on constructing exact solutions of the parabolic wave equation in open subdomains free of nonuniform diffractive objects. As a result, an exact nonlocal boundary condition is derived providing full transparency of the artificially introduced computational border. This technique leads to an essential reduction of the computing time without any loss of accuracy, which is illustrated by practical examples from radio propagation and X ray diffractive optics. Extension of the method onto quasi-stratified environments and modified parabolic equations is discussed.