The NPN prox sensor can be modelled as a switch that closes and connects to ground when it senses something, and is open when not. That explains why your signal is fluctuating -- it doesn't have a well-defined logic level when open (i.e., it is "floating").
Try the following circuit for interfacing. The 10k resistor keeps your board input near 5V when the sensor is "open", and the sensor should pull the input to 0V when "closed". The zener diode is just a little bit of protection to make sure your board doesn't ever see 12V!