Which of the following is a correct sentence?
He was waiting for two hours after she had arrived.
or
He had been waiting for two hours after she had arrived.
Which of the following is a correct sentence?
He was waiting for two hours after she had arrived.
or
He had been waiting for two hours after she had arrived.
With no other context, there is no reason not to use the first. Don't use past perfect just because some action occurred after some other action.
But the second is grammatically correct too.
You use the past perfect when speaking of events that occur before the time talked about in the paragraph. So without the context of the rest of the paragraph it's impossible to say which is better.
If you set the time of the paragraph as "when John was sipping his wine", and the time he was waiting was before the time when he was sipping his wine, then past perfect might be justified as below.
John sat in the restaurant sadly sipping his wine. His date had already left with another man. John had been waiting for two hours after she arrived, as she flirted with all the other men in the club....
Note that I've use simple past in the subordinate clauses. Past perfect just seemed too "heavy".
But if the time you are talking about is "the time when he was waiting", just use past tense:
She arrived at 8, went over to John and asked if he "didn't mind waiting a few minutes, as she fixed her face". John smiled and nodded. He was waiting for two hours after she arrived and he began to suspect that she wasn't going to come back...