I'm getting the same two codes on my 2003 MSP. Have you solved this problem yet? Mine started with a rough idle that drops as low as 400 rpms, I had a mechanic check it out and they said they were lead to one of the vacuum solenoids. They found it was dirty so they cleaned it off, tested it, and put it back in, cleared the codes and charged me $90. The CEL came back on the next day. Recently the problem has been getting worse so I'm trying again to figure it out. From what I understand the P0171 code could point to a number of things including bad or dirty MAF, bad fuel pressure regulator, vacuum leak, or O2 sensor. I don't know much about the second one, but I assume they're related since they both showed up at the same time. I'll be sure to post more here if I figure it out.