A relay is an electrically operated switch. And relay is used where it is necessary to control a circuit by a separate low-power signal, or where several circuits must be controlled by one signal.
A sensor is a device, module, or subsystem whose purpose is to detect events or changes in its environment and send the information to other electronics, frequently a computer processor. That’s to say, a sensor converts external data into an electrical signal and which is always used with other electronics. (WIKI)