How do I get the voltage to stay at 5V when using air pumps?
You have motors for 3V at 350 mA. At 5V they will draw more current. You have 2 other solenoids at 263 mA.
The arduini mega 2650 has a usb in thats hard limited to 500 mA by a poly fuse. And the barrel input at 1A rated diode and a linear regulator thats only really good to 800 mA output. We don't know what your supply is at as that can cause other issues. With your motors and solenoids alone thats already over 1 Amp.
Plus your 2n2222 are being driven at 5V - 0.7V / 120 ohm = 35 mA each. That introduces more current draw through the arduino regulator. It also causes issues as each pin is rated at 40mA max with significant voltage droop, plus i think your running these all of the same port on the microcontroller and that has a total port maximum too.
And I see no power capacitors so large quick changes in the power lines will cause drops.
Suggestions: power the motors and solenoids off their own supply/regulator. Add a 1000 uF capacitor near the arduino, and near the power supply for the motors. Reduce your arduino outputs to 20mA per pin. A 240 ohm resistor would do that instead of 120 ohm. 20 mA at the 2n2222 transistor base will still put it in full saturation for a 350 mA collector current.