As the feature sizes printed with optical lithography get smaller, Kirchhoff’s thin mask approximation used in full chip optical proximity corrections (OPC) fails to yield acceptable accuracy due to thick mask diffraction effects. One of the most observed effects of the thick mask diffraction is that it creates different focus shift for different patterns. When Bossung curves (CD plots with respect to defocus) of various patterns are observed from rigorous simulations and from actual wafer data one can notice that each pattern has a different best focus. Depending on the pattern, Bossung curves can be offset in either positive or negative direction. This significantly reduces the common depth of focus (DOF) for which all patterns print with acceptable fidelity. Even though each pattern by itself may have an acceptable DOF, the common DOF may not be acceptable. Several extensions to the thin mask approximation have been developed that model this behavior accurately, such as boundary layer approximations and domain decomposition methods. These methods provide a more accurate approximation than the thin mask model while still being computationally efficient to be useful for full chip OPC. Even though these approximations model and predict the focus shift accurately, to the best knowledge of the authors no method has been published to use these modeling capabilities to automatically fix this focus shift during OPC. In this paper we provide an optimization method to significantly reduce focus shift due to 3D mask effects during OPC. We show that our 3D mask model can predict this focus shift fairly accurately and we also demonstrate how we use this model in OPC to reduce focus shift, which significantly improves the common DOF for the entire layout.