I used a 9 volt battery and then regulated by 7805 IC then connect +ve 5 volt to VCC wire of the sensor and the ground with GND
Are you sure you got it connected the right way around? (It may be hard to see which is pin 1).
The sensor draws pulses of more than 200mA, so if your 9V battery is an alkaline PP3/"Transistor battery", it hasn't got the stamina for the task.
You can test if that's the case by measuring the input to the regulator. If it gets under 7.5..8V, it won't quite cut it.
A capacitor right at the sensor supply terminals is needed, no matter the supply.
A cap of at least 100µF (up to say 470µF), will help if it's a fresh alkaline PP3 - if it's not fresh... Forget it). Let the cap charge to the full voltage before you connect the sensor.
Placing this cap before the regulator is best (and a smller one may do it then. This is because you have a bit more allowed voltage drop before things go wrong than on the 5V side.
To sum up: Cap of 100..470µF on the input of the regulator, ~22µF on the output of the regulator and 10..47µF right on the terminals of the sensor.