In the present paper we obtain an anisotropic analog of the Durgapal and Fuloria (Gen Relativ Gravit 17:671, 1985) perfect fluid solution. The methodology consists of contraction of the anisotropic factor with the help of both metric potentials e ν and e λ . Here we consider e λ the same as Durgapal and Fuloria (Gen Relativ Gravit 17:671, 1985) did, whereas e ν is as given by Lake (Phys Rev D 67:104015, 2003). The field equations are solved by the change of dependent variable method. The solutions set mathematically thus obtained are compared with the physical properties of some of the compact stars, strange star as well as white dwarf. It is observed that all the expected physical features are available related to the stellar fluid distribution, which clearly indicates the validity of the model.