James Anderson and Jack Leach each took three wickets to leave New Zealand 279 runs behind after day two.