What cam, valvesprings, and heads are you using?
Also...what happens at 5000rpm? Does it just run out of power...or is it dramatic? Like popping, sputtering, or anything like that. Does it happen in every gear at 5000, or just top gear at 5000?
Faulty ignition can definitely cause issues with making RPM, but we would have to verify everything else just to make sure its not obivously something else.
I guess a good question to ask would be, did you ever have any other ignition on this motor? And if you did...how did the motor run with the other igition? If the problems started immediately after swapping distributors, then an ignition problem either caused by, or as a result of the new distributor would be the safest place to look.
Did you bypass the factory resistor wire and make sure that HEI distributor is getting a full 12 volt signal?