Any lights on the dash? It sounds like its in limp mode. Clean the maf with electrical contact cleaner, while thats drying disconnect the battery, reconnect everything, check for loose connections or air leaks. If still not reving past 4k could be maf is fooked. Was it a new or second hand one? Also get the codes read, am not sure but i think cam sensor issues can have similar symptoms. Let us know how you get on.