With a new intake installed you need to inspect that all connections are sealed. If you cannot find what is allowing more air or even less fuel...you may just need a new 1st position O2(closest to the engine) or a new MAF. If you clear the codes and unplug the MAF and it runs better...try a new MAF. Likely need to run data for fuel pressures as well with injector replacement or nozzle cleaning lastly.
 Possible Causes for P0171
    Mass Air Flow Sensor (G70) defective
    Intake System Leak(s) 
Possible Solutions
    Check Mass Air Flow Sensor (G70)
    Check Fuel Pressure Regulation
    Check Fuel Pump
    Check Injectors
    Check Intake System for Leaks
    Check Exhaust System for Leaks
    Check Secondary Air System for Leaks
    Check Vacuum Pipes for Leaks
 Possible Causes for P2177
    Fuel Pump (G6) faulty
    Mass Air Flow (MAF) Sensor (G70) faulty
    Intake System leaking
    Exhaust System leaking
    Wrong Fuel Pressure Sensor (G247) on Fuel Rail 
Possible Solutions
    Check Mass Air Flow (MAF) Sensor (G70)
    Check Fuel Pump (G6)
    Check Fuel Injectors
    Check Intake System
    Check Exhaust System
    Confirm correct Fuel Pressure Sensor (G247) part number