Using logic gates instead of Arduino
I'll start by pointing out that  your code is probably faulty. The last IF statement should examine switch 1 and switch 3, not 1 and 2.

With that said, let be restate your requirements:

1) If either SW2 or SW4 are open, start filling the tank (turn on the motor).

2) When both SW1 and SW3 are open, stop filling the tank (turn off the motor).

Right? And you do realize that this may cause one tank to overflow while the other tank is filling, right?

In this case, as @on8tom has pointed out, you need some sort of storage device, and a set/reset flip-flop is an excellent choice. Then







simulate this circuit &ndash; Schematic created using CircuitLab
should do what you want. Note that I've added a flyback diode on the relay coil, and you should always do this. The diode should be rated for more current than the relay coil draws.