The invention provides a friction-nanogenerator-based molecular sensor. The sensor comprises a first conducting element, a first friction layer, a second conducting element, a second friction layer, a modified layer and an elastic connecting component, wherein the first friction layer is placed on the lower surface of the first conducting element in a contact mode, the second friction layer is placed on the upper surface of the second conducting element in the contact mode, and the modified layer is combined with the upper surface of the second friction layer; by the elastic connecting component, the lower surface of the first friction layer is opposite to the upper surface of the second friction layer, and a certain distance is respectively kept between the lower surface of the first friction layer and the upper surface of the second friction layer; the lower surface of the first friction layer is at least partially in contact with the upper surfaces of the second friction layer under the action of external force, and the distance respectively between the lower surface of the first friction layer and the upper surfaces of the second friction layer can be restored under the action of the elastic connecting component when external force is removed, and simultaneously, electrical signals are outputted outwards through the first conducting element and the second conducting element; the electrical signals can be changed after the modified layer is combined with a target material to be detected.