If the PCV valve is loose, fix it. It can cause a variety of issues.
Don't mess with the EGR valve, they rarely fail. Check the DPFE sensor for proper operation and check for a clogged EGR port.
Fix the misfires and see if that also solves the "lean" code.
Reset the PCM after repairs so that it starts fresh.