For the money...I would change the plugs & wires. I had a 2 year battle with po171 and it turned out to be plug wires. The terminal on one wire had actually rusted inside of the boot...not sure I would have even seen it if the boot hadn't tore removing it.
P0171 trips when the oxygen sensor senses excessive oxygen in the exhaust stream. Anything that interferes with proper combustion or what the oxygen sensor reads will cause it to trip
That said it can be caused by low fuel pressure/restrictions including fuel pumps, clogged fuel filters, sticky injectors etc. but it can also be triggered by incomplete combustion...in my case a weak spark on cylinder 6 caused by the rust Plug doesn't fire hot enough 02 sensor reads it .computer adjusts fuel trim thinking it needs a richer mix. when it has adjusted as far as it can and still reads too much 02 it pops the light on.
Also a possible concern is any type of vacuum leak at the intake manifold, or an exhaust leak at the EGR or the exhaust manifold. This one can drive you crazy I looked at all kinds of potential causes. There isn't much easier or cheaper than wires
In my case it would pop the SES light on once every 25-50 miles and the car seemed to run great most of the time.