The invention belongs to a photoelectric liquid level sensor. The photoelectric liquid level sensor comprises a floating ball assembly, a photoelectric control assembly and a mounting assembly, wherein the floating ball assembly comprises a floating ball, a floating ball guide rod, a nut A, a nut B and a filter screen; the photoelectric control assembly comprises a transparent shell, a PCB, a light tube support, an infrared transmitting tube, an infrared receiving tube, an O-shaped sealing ring, a base, a nut C, an electric wire I, an electric wire II, an electric wire III, a flat washer 1 and a connector. The mounting assembly comprises a connecting elbow, a guide rod, a flat washer 2, a nut A, a terminal and a connector, the photoelectric control group is fixed on the floating ball guide rod, and the mounting assembly is connected to the connector. The floating ball is driven to move up and down in the inner cavity of the floating ball guide rod by utilizing the buoyancy of liquid and the gravity of the floating ball, and light rays emitted by the infrared transmitting tube are shielded or avoided through the floating ball, so that the infrared receiving tube generates corresponding low voltage or high voltage to realize liquid level detection; the floating ball is used for directly shielding and avoiding light, generated high and low voltages are large in difference, and detection signals are stable and accurate.