Cahn introduced the concept of wall energy to describe the interaction between two immiscible fluids and a solid wall [J. W. Cahn, J. Chem. Phys. 66, 3667–3672 (1977)]. This quintessential concept has been successfully applied to describe various wetting phenomena of a droplet in contact with a solid surface. The usually formulated wall free energy results in the so-called surface composition that is not equal to the bulk composition. This composition difference leads to a limited range of contact angles which can be achieved by the linear/high-order polynomial wall free energy. To address this issue and to improve the adaptability of the model, we symmetrically discuss the formulation of the wall free energy on the Young’s contact angle via Allen–Cahn model. In our model, we modify the calculation of the fluid-solid interfacial tensions according to the Cahn’s theory by considering the excess free energy contributed by the distorted composition profile induced by the surface effect. Additionally, we propose a semi-obstacle wall free energy which enforces the surface composition to be the bulk composition within the framework of bulk obstacle potential. By this way, the accuracy of the contact angle close to 0° and 180° is significantly improved in the phase-field simulations. We further reveal that the volume preservation term in the conservative Allen–Cahn model has a more significant impact on the wetting behavior on superhydrophobic surfaces than on hydrophilic surfaces, which is attributed to the curvature effect. Our findings provide alternative insights into wetting behavior on superhydrophilic and superhydrophobic surfaces.