Rpm restriction

I have a 2000 grand prix with a 3.1 engine.When in gear or idling if I rev it up to a little over 4000 rpm the idle will drop back down to under 4000 and then back up to a little over 4000 and repeat the cycle. I have replaced the module, plug wires and plugs. the fuel pressure is around 50 and drops only a pound or two when the idle drops. any ideas? thanks

why do you need to rev it up over 4,000?

Does it have any driveability problems when you try to take the rpm above 4000 rpm on the road under load? For example what happens when you accelerate up a hill in second gear? Can you get over 4000 rpm?