Do you actually need the opto-isolation? The switch would drive an NPN transistor into saturation when it closed, or a small N-MOSfet. You'd need a pull-up resistor to +5V to get the voltage swing you want, but it's much the same circuit with less to go wrong.