STOPPING A SERVO

The code in Reply #4 does not print the value of the variable val. In fact the code is almost identical to the code in your Original Post.

Write a simple program that gets a value from the PIR sensor and just prints the value to the Serial Monitor. There is no point worrying about other parts of the program until you can read the sensor reliably.

Post a link to the datasheet for the PIR sensor.

Also post a diagram showing clearly how you have connected the sensor to your Arduino.

What, exactly, do you mean by

Meanwhile the servo, it is still moving despite being the PIR being HIGH or LOW.

...R