‘have been’ VS ‘were’
They are both ways of expressing something that is counterfactual: who or what he is speaking about is not an old friend. It could be a stranger, an enemy, or even a comfortable pair of old shoes, say. He is speaking of the subject as if speaking about an old friend.
as if he were... uses the subjunctive form of the verb BE, and as if he had been... uses a back-shifted tense (past perfect of BE).
P.S. Consider the following. Assume as a contextual fact that "She" has never been to this bar before:
She walked up to the bar and greeted the man tending bar as if she had been coming to this bar for years.
She walked up to the bar and greeted the man tending bar as if she were a regular customer.
The phrase "as if she had been coming to this bar for years" refers to a counterfactual condition which, if it were true, would predate the action of walking up to the bar and greeting the bartender.
The phrase "as if she were a regular" refers to a counterfactual condition which, if it were true, would be contemporaneous with the action of walking up to the bar and greeting the bartender.