The data transmission process in Wireless Sensor Networks (WSNs) often experiences errors and packet losses due to the environmental interference. In order to address this problem, we propose a Compressive Sensing data gathering algorithm based on Packet Loss Matching (CS-PLM). It is proven that, under tree routing, the packet loss on communication links would severely undermine the data reconstruction accuracy in Compressive Sensing (CS) based data gathering process. It is further pointed out that the packet loss in CS based data gathering exhibits the correlation effect. Meanwhile, we design a sparse observation matrix based on packet loss matching and verify that the designed matrix satisfies the Restricted Isometry Property (RIP) with a probability arbitrarily close to 1. Therefore, reliable transmission of the compressed data can be guaranteed by adopting the multipath backup routing among CS nodes. It is shown in the simulation results that, with a 60% packet loss ratio of the link, the CS-PLM algorithm can still ensure the effective reconstruction of the data gathered by the CS algorithm and the relative reconstruction error is lower than 5%. Therefore, it is verified that the proposed algorithm could effectively alleviate the sensitivity to packet losses for the CS based data gathering algorithm on unreliable links.