Replacing a relay by a transistor
First - don't power a pump from USB unless it will consume less than 200mA. Keep that in mind for future applications/projects. DC motors will draw very large start-up currents, and this can blow your USB hubs or their fuses, and other nasty things. Of course, a 1.5A USB phone charger plugged into the wall would be fine for most things! Always be careful about your choice of power inputs, often noobies will forget or downplay the importance of checking that all of their rated inputs/output power requirements in the project are going to work. 

According to a dodgy datasheet for that product I just found, it can pull up to 360mA at 7.2V, so make sure it's not running off a computer USB port.

Because the load is only 360mA though, you can get away with a nice and small MOSFET as a switch instead of a relay. Because the pump is just a DC motor, you can switch it with a low-side N-channel MOSFET configuration. 

Here is an example circuit for you:







simulate this circuit &ndash; Schematic created using CircuitLab

The way this works is the USB 5V+ goes into the pump pin, and the pump's other pin goes to the MOSFET's Drain pin. The MOSFET's Source pin goes to GROUND. 

Make sure to tie the two difference supply's GROUND pins together.

The SIGNAL input to the MOSFET's Gate pin comes from your Arduino. When the SIGNAL goes high, the MOSFET will turn on, and act like the relay did. When the SIGNAL goes low, it will turn off the MOSFET. The pull down resistor R2 is there to ensure it actually turns off, and will also prevent a noisy start-up condition triggering the pump. 

The resistor R1 is optional, but good practice. 

You should also probably have a Schottky diode from the -ve Pin of the pump to the +ve Pin of the pump in the way I've drawn it, as an inductive voltage spike clamp for when the pump turns off. 

I suggest you DO indeed put a 1000mF or more capacitor (go for a 16V or 35V rated one just for the funz. If you do a 6.3V one, it may pop if you don't put the over voltage clamp on it as I mentioned). 

This capacitor will assist with the start-up surge currents which can cause brown-outs and other issues as you have encountered. 

You may want to properly filter/protect the sensor too, by putting a 0.1uF (100nF) capacitor on the power supply leads for it.