As time goes by, increase in world energy demand forced oil and gas companies to drill deeper in order to produce more oil and gas for quenching the thirst of human needs. This requires drilling layers with various lithologies with variable characteristics and dealing with more drilling problems as going deeper. Mechanical Earth Model (MEM) should be developed to bypass drilling problems. This model will be used for analyzing instability of the wellbore wall, selecting optimized azimuth and inclination for well trajectory, optimized perforation, sand production analysis and stimulation operation design. In this paper, a mechanical earth model is developed for one of the Iranian fields in Middle East and then drilling data are employed to optimize well trajectory based on wellbore stability models and higher penetration rate. Theoretical results show remarkable increase in drilling performance and applying optimized parameters will shorten drilling operation.