This paper proposes a trajectory optimization approach for multi-sensor multi-target search and tracking using bearing-only sensors. Based on the framework of the joint integrated probabilistic data association (JIPDA) filter, the intensity of potential unknown targets is updated according to the trajectories of the UAVs. The performance indices for target search and tracking are constructed based on, respectively, the intensity of unknown targets in the search area and the tracking error covariance. A dimensionless criterion, evaluating the search and tracking performance, is formulated and leveraged as the objective function of the UAV trajectory optimization problem. Simulations were carried out in different search and tracking scenarios to demonstrate the effectiveness of the proposed approach.