Your problem is either:-
- Your battery can't supply enough current for two servos.
- Your servos are generating so much noise on the power rail you are resetting the arduino.
Possible Solutions:-- Use a separate battery to power the motor and the arduino (but connect the grounds together)
- Add some large decoupling capacitors across the supply, 47uF or larger along with a 0.1uF ceramic in parallel.
Ok. I have to test those options tomorrow. But I am amazed. Because can even defining of ports with pinMode()-functions took so much power?