Population-based algorithms have become a research hotspot for optimization problems and have been widely applied in various fields in recent decades. This paper presents the birds foraging search (BFS) algorithm, which is a novel population-based optimizer inspired by the different behaviors of birds during the foraging process for solving global optimization problems. The overall framework of the proposed algorithm involves three phases: the flying search behavior phase, the territorial behavior phase and the cognitive behavior phase. In the proposed algorithm, the first two phases balance the exploration and exploitation capabilities of the algorithm, and the third phase enhances the search efficiency. Classical benchmarks and CEC2014 benchmarks are employed to fully evaluate the performance of our BFS. The statistical results reveal that the BFS algorithm outperforms other conventional approaches and state-of-the art algorithms in terms of accuracy and convergence.