Barrier coverage problem is one of the most crucial issues in wireless sensor networks (WSNs) which have been applied to a wild range of applications. A lot of algorithms have been proposed to cope with this problem. However, the majority researches apply the Boolean Sensing Model (BSM) and the sensing frequency of the sensor is not considered, which are difficult to reflect the physical features of the sensing component. This paper proposed a barrier coverage algorithm, called Guaranteeing Surveillance Quality with Minimal Number of Active Sensors, or GSMS in short, aiming to guarantee the surveillance quality for a given monitoring region while activating the minimal number of active sensors. By applying the Probability Sensing Model (PSM) and considering sensing frequency, the proposed GSMS algorithm calculates the sensing probability of every location in the monitoring region and identifies the bottleneck location of surveillance quality. Then the GSMS algorithm prior schedules the sensor with the maximal contribution to the bottleneck location in terms of surveillance quality. The experimental study reveals that the proposed GSMS algorithm outperforms the existing algorithm in terms of the number of active sensors, lifetime of the WSNs, efficiency as well as the cooperative sensing probability.