Edgar Linton represents civilization; he is the order to Heathcliff's chaos, and reason to Heathcliff's emotional extremes. Edgar is the "first man in the county" -- a rich squire whose house, significantly down the hill from Wuthering Heights, and considerably newer and more comfortable, is called Thrushcross Grange. The difference between the two houses - The Heights and The Grange -- is quite marked. This mirrors the difference between the two men; while Edgar is a gentleman, comfortable in drawing rooms and reading books (and reaping the profits of being a gentleman farmer), Heathcliff is more at home in the wide world, hunting and roaming.
To Cathy, Edgar represents stability in the world, while Heathcliff is all the wild (and attractive, if dangerous) instability in that same world. She chooses Edgar, possibly for selfish, mercenary reasons (Edgar was richer and would give her better social position than Heathcliff), or, possibly, because she knew that Heathcliff, while intensely attractive, was not good for her. Edgar also represents legitimate (in those days, mostly inherited) authority. His parents were known, and he received his wealth and position by his legitmate birth. Heathcliff was adopted as a street urchin, with no known parents. While he eventually gains authority and riches in the world, he does so by his wits, and, it is implied, by nefarious means. He tricks and tortures the Heights out of Hindley, rather than inheriting the Grange from his father as Edgar did. The two men represent entirely different kinds of power; Edgar having the legitimate, comfortable kind, and Heathcliff having the socially dangerous, unsettling kind. Both men are powerful, but in very different ways.
You could say that Edgar is really a character which serves only as a foil to Heathcliff. But any foil is, in the end, just as important as the character he or she is "foiling". The foil defines the opposite character -- if there was no Edgar to be contrasted with, Heathcliff would not seem nearly so wild and dangerous. For Heathcliff to know the kind of codified, caste-system, hereditary power that Edgar represents is to be able to rebel against it and make his own power. Without Edgar, Heathcliff would seem more a cruel, corrupt, resentful person than a romantic hero (and it could be interpreted that he is both, or neither!). Contrasted with Edgar, Heathcliff can seem more a revolutionary, misunderstood character than an unmitigated villain.
Both characters are essential to each other. It would be hard to understand Heathcliff in the same way if the character of Edgar did not exist (besides the plot of the novel being significantly different!)
Edgar is basically everything that Heathcliff isn't. Edgar is successful, rich, and proper while Heathcliff is an orphan who only lives with a successful rich and proper family. Edgar is who Catherine feels she has to be with and that will bring about the downfall of Heathcliff and eventually Catherine.