In the emergency scenario of Unmanned Aerial Vehicle (UAV) relay, link interruption caused by shortage of communication resources often occurs. Using spectrum sensing, UAV can expand communication bandwidth and ensure communication quality. However, spectrum sensing of UAV will increase energy consumption and reduce UAV dwell time. Aiming at the contradiction of energy consumption and communication quality, this paper proposes a relay sensing decision algorithm. Firstly, the spectrum sensing model and algorithm are established. Then, the outage probability is taken as the threshold value adjusting three-dimensional coordinates in the UAV relay sensing decision algorithm. Finally, we construct a UAV relay sensing decision algorithm, which adds the limit of unless outage probability threshold to the firefly algorithm to adjust the position of UAV. By adjusting the three-dimensional coordinates of UAV, the unless outage probability is guaranteed for UAV relay link. Through the simulation of building emergency fire scene, it is verified that the UAV relay sensing decision algorithm can automatically find the optimal UAV sensing position and ensure communication quality.