Calculating Speed with Two Sensors

Exactly which PIR's are you using? Not all PIR's are the same, and some have bizarre behaviors. Did you narrow their detection range by putting them inside of a tube? If not, I highly recommend it. Also PIR's can give you a lot of false triggers, especially in sunlight, and especially if the field of view isn't narrowed.

One possible flaw you may not have thought of is your speed timing might vary widely depending on house close or house far away the car is from the PIR's. Especially if the field of view is significantly narrowed. Let's say car 1 and car 2 appear one after the other with sufficient margin between them, and they are both driving the same direction at exactly the same speed. Car 1 is driving on the far side of the street, and car 2 is driving on the near side of the street. Because car 1 is further away, it will likely be detected with a wider field of view than car 2, and thus the timings might be different between the cars. That said, I don't think that's why you are getting such erratic results.

I'm not a fan of how you are doing the detection on your sensors. If I could perhaps suggest a different way?

I'd rather read both sensors continuously in the main loop and I'd use a state machine to determine when to calculate and display results. Basically you snapshot a timestamp when one of the PIR's goes high and set the state to indicate which direction the car is coming from. Then you continue your loop doing other things until the opposite sensor goes HIGH, and you snapshot a timestamp for when it does and then you calculate your speed. This way you can be updating a display or doing other things while waiting for the opposite sensor to trigger without having to be stuck in a function or a loop.

Something like this:

#define STATE_IDLE                0
#define STATE_DETECT_FROM_LEFT    1
#define STATE_DETECT_FROM_RIGHT   2

int state = STATE_IDLE;
unsigned long sample_start = 0;
unsigned long sample_end = 0;
boolean leftsensor;
boolean rightsensor;
int left = 3;
int right = 4;

void setup()
{
  pinMode(left, INPUT);   
  pinMode(right, INPUT); 
}

void loop()
{
  boolean leftsensor = digitalRead(left);
  boolean rightsensor = digitalRead(right);
  
  switch(state)
  {
    case STATE_IDLE:
    {
      if (leftsensor == HIGH)
      {
        sample_start = millis();
        state = STATE_DETECT_FROM_RIGHT;
      }
      else if (rightsensor == HIGH)
      {
        sample_start = millis();
        state = STATE_DETECT_FROM_LEFT;
      }
    }
    break;
    
    case STATE_DETECT_FROM_LEFT:
    {
      if (rightsensor == HIGH)
      {
        // The right sensor just triggered, this means
        // we should calculate and display the speed.
        sample_end = millis();
        calculateSpeed();
        state = STATE_IDLE;
      }
    }
    break;
    
    case STATE_DETECT_FROM_RIGHT:
    {
      if (leftsensor == HIGH)
      {
        // The left sensor just triggered, this means
        // we should calculate and display the speed.
        sample_end = millis();
        calculateSpeed();
        state = STATE_IDLE;
      }
    }
    break;
  }
}

void calculateSpeed()
{
  unsigned long duration = sample_end - sample_start;
  
  // do speed conversion math here using duration
  
  // display results here
  
  // delay until sensors reset
  while (digitalRead(left) == HIGH || digitalRead(right) == HIGH)
  {
    delay(10);
  }
}

You can easily check the direction by looking at which state we are in from the calculateSpeed() function.

EDIT: You can also easily add some timeout logic to reset the state to STATE_IDLE if the opposite sensor never gets triggered within a certain timeframe.