Charley and Bernard play an important role in the play Death of a Salesman by Arthur Miller because they serve as foils of Willy and his two sons. This means that Charley, a successful man, and Bernard (his equally successful son) allow the audience to contrast the reality of Willy's foolish life versus what could have been if Willy had developed a normal relationship with Biff and Happy.
We know that Charley is Willy's neighbor and perhaps his only true friend. Without complaint, he continuously offers Willy a job and gives him money every week for Willy to take to his family. This, of course, he does secretly and to save Willy's reputation with his family.
Moreover, we also know that Charley was the only attendant at Willy's funeral. We see how Charley seems to have a deeper grasp of Willy's personality and of his situation. Yet, in contrast to Willy, Charley would never be capable of praising himself nor feel superior to anybody.
Conclusively, the role of Charley and Bernard is to foil the Loman's dysfunctional family, and to serve as the only supportive link between Willy and the real world. If it weren't for Charley, Willy would have not been able to feed his family, we assume. Also, without Charley's support, the Lomans would have found themselves desolate at Willy's funeral. Hence, Charley and Bernard represent Willy's only real support system, and are the best example of a true friendship.