Firefly algorithm (FA) belongs to the swarm intelligence algorithm, which is famous for its strong exploration, a small number of parameter settings and effortless operation. However, there are some drawbacks in the searching process for FA, as the poor accuracy of the solution, high-computational time complexity, and doughty oscillation. These phenomenons are attributed to two factors: 1) in classical FA, the firefly, which is gloomier than others can be attracted by any one of them and 2) FA cannot fully utilize the information of objective function and its fitness. In this paper, to overcome these shortcomings, based on specific probability p fit , a new modified firefly algorithm (pFA) is proposed. In this algorithm, for speeding up the convergence, the specific probability p fit determined by the value of fitness of the firefly is used to choose a neighbor among the better fireflies compared with the predefined firefly, which helps the predefined firefly to move toward a better direction. If there is no neighbor, the opposite learning strategy is employed to lead the firefly to move. The performance of pFA is tested on some well-known benchmark functions. The findings of the test show that pFA is outperformed to FA and some other state-of-the-art algorithms. Finally, we apply pFA to solve four engineering applications.