Check for and fault codes. Also check your fuel pressure. I had the a similar issue and ended up being the fuel pump wearing out. But you can check this by verifying that have the correct fuel pressure. Is at a certain speed or just at those rpm ranges?