Sensors play a fundamental role in achieving the complex behaviors typically found in biological organisms. However, their potential role in the design of artificial agents is often overlooked. This often results in the design of robots that are poorly adapted to the environment, compared to their biological counterparts. This paper proposes a formalization of a novel architectural component, called a metasensor, which enables a process of sensor evolution reminiscent of what occurs in living organisms. The metasensor layer searches for the optimal interpretation of its input signals and then feeds them to the robotic agent to accomplish the assigned task. Also, the metasensor enables a robot to adapt to new tasks and dynamic, unknown environments without requiring the redesign of its hardware and software. To validate this concept, a proof of concept is presented where the metasensor changes the robot's behavior from a light avoidance task to an area avoidance task. This is achieved through two different implementations: one hand-coded and the other based on a neural network substrate, in which the network weights are evolved using an evolutionary algorithm. The results demonstrate the potential of the metasensor to modify the behavior of a robot through sensor evolution. These promising results pave the way for novel applications of the metasensor in real-world robotic scenarios, including those requiring online adaptation.