Maintaining voltage at 5V, but voltage must be able to change
There are 3 ways you could achieve restricting the voltage from going over 5 volts.


You could clamp it by using a zener diode at 5V along with a resistor to restrict too much current going through the Zener diode. See this.





You could use a resistor voltage divider to scale the output from the sensor to make the maximum voltage at 5 volts. But make sure you know the sensor's output voltage will not reach over than what you predicted. To prevent something like this from destroying your target device, add a zener voltage clamper at the output.
Use an operational amplifier