Check your fuel pressure to be sure it in the presurre range, if it is not
it will do what you been having, the fuel pump is not building up enough
pressure when the engine is in load(put in gear) but will run fine when
not in load. Also replace the fuel fiter too as these sometime get
overlooked and not replaced at regular schuled time. The pump is in the
fuel tank, would have to drop the tank to replace it.