You need some signal-conditioning. Firstly a low-pass filter is needed to remove all the spikes and noise - this filter should have a roll-off about 3 or 4 times higher than the max frequency of pulses I guess.
Secondly the amplitude is very small (I wonder why - normally such a signal would be logic level). Given that there might be offset voltages that change I'd suggest using a high-pass filter at or below 1Hz to remove any DC bias, then low-pass filter to remove the noise, then put the output into a comparator. Something like:
The initial 10k/15nF gives a 1kHz low pass, the 3u3/100k a 0.5Hz high-pass (dc-blocking). The diodes protect against grossly overvoltage inputs. C is any open-collector 5V-compatible comparator, such as 1/4 of LM339
The only issue with my circuit is that it could generate random noise when there are no pulses coming in.