Assuming your air intake and vacuum sensor as well as fuel pump, seals and injectors are OK, the only thing left is, some of them are already mentioned above.
1) Check the Vacuum pump (most likely caused)
2) Fuel pressure sensor
3) Check the lines to common rail if they are not clogged
4) Check common rail itself for pressure tightness/integrity
Please give us a feedback, whatever is the cause, and as you know start the engine after doing a reset of ECU by taking the negative terminal off for 3-4 minutes.
Sorry forgot to mention, when the check engine lights comes up, the ECU automatically limits the revs to less then 3K (????) and this is why you cannot rev it up anymore.
Cheers,
Kaleem