If you're using (left var porta.0), and have this pin set to an input, why are you trying to clear the pin with (porta.0 = 0)..?

Just let your sensor handle the logic level transitions.

Some sensors have a certain amount of hysteresis so it may take a while for the sensor to initially trigger or for the output to settle & return to the idle state once the trigger condition is removed.

The PIC input pin will see a logic 1 until the sensor outputs falls below the PIC +V input threshold level.

If you need to speed up the process of returning to the idle state, you can probably add a 10K or more pull-down resistor to help discharge the sensors output, but I would check the datasheet for the sensor you're using first. If the sensors output doesn't hold the PIC input at ground when idle, you'll need the pull-down anyhow.

Using mister_e's WHILE WEND suggestion works really well, but the sensor output needs to fall below the PIC +V input threshold before it will exit the WHILE WEND. That could explain the delay.