Who is the unhappier? The unrequited lover, his passions awakened but unfulfilled, or the love object, ignorant of such exquisite suffering? Or have both characters developed in such a way as to make their roles inevitable and, in some curious way, satisfying to them? If there are answers to these romantic puzzles within the pages of Edmund White's wittily meandering tale of the relationship between two friends over three decades, then the last people to grasp them are Jack Holmes and Will Wright, the pair in question.

As the novel's title suggests, it is Jack who is initially brought into sharper focus, although the idea that close observation demystifies him – either to us or to himself – is one of the little games that White plays throughout. When we first meet him, as a promising student, he is already a contradictory character: "excessively pliable", "a 'nice' boy who knew how to please others" but who can nonetheless come across as snooty and aloof. "Strange" parents lurk unseen in the background; academic enthusiasms melt away unmourned; his most successful relationship is with a hearty girl who quickly confides in him about the "spasmophilia" that makes her reluctant – provoking a striking lack of concern on his part – to have sex with him.

Jack has a variety of ambitions but little in the way of direction; moving to New York after graduating, he falls into a bohemian apartment-share with two girls, one of whom is rather more erotically obliging than his student girlfriend, and into journalism – "at least that sounded kind of cool". It is at the high-end Northern Review that he experiences the coup de foudre that will apparently determine the course of his life, plunging him deeply in love with Will Wright. Socially confident and possessed of an unnatural ease, Will glows with "a Princeton luster", although he is not without his weaknesses: his skin bears the ravages of teenage acne and, in another of White's winks to his audience, he tends towards extreme pretension when talking about the novel that he intends to write. Will's unassailable heterosexuality becomes the catalyst for Jack's emerging homosexuality; where once he felt that "with a woman you could have a real relationship conducted in the sunlight, whereas this homo thing was just slithering around in the shadows", he becomes increasingly happy to indulge his "sickness" with a variety of partners. In this, he is aided by his natural attributes, although, as a ballet dancer with whom he has a brief relationship tells him, the size of his penis could frighten some gay men off: "They'd throw it over one shoulder and burp it and weep." The dancer doesn't last long, but then neither do many of Jack's conquests: for true companionship, he has Will, who has survived, with commendable grace, the revelation of Jack's adoration of him.

Things, however, are never that simple. Jack Holmes and His Friend presents us with more than one novel in its 400 pages: there is an almost philosophical meditation on the nature of romantic and erotic desire; a sharp period portrait, centred on 1960s New York; and a social history of sexuality over 30 years, in which homosexual relationships begin as clandestine affairs and progress through a heyday, much enjoyed by Jack, of outright libertinism that ends with the advent of Aids. But alongside all three is a more ambiguous exploration of friendship, in which loyalties and priorities change over time, external events and figures exert unexpected influence, and the balance of power shifts without anybody seeming to notice. Jack and Will's friendship, for example, includes two extended ruptures, both of them heralded by crises in Will's life: once, when a terrible review of his novel casts him into despair and propels him, albeit chastely, into Jack's arms; and, many years later, when his marriage falters and Jack, acting as a bizarre kind of Pandarus, sets him up with the plump, sexually voracious and dirty-talking Pia. The breaks in the narrative allow White to nudge his story forward by several years at a time, but also to shift point-of-view, moving from a third-person description of Jack's life that mirrors his tendency towards detachment, to Will's first-person account of his adventures, which strengthens our view of him as a rather bland sentimentalist. (Continuing the literary joke, White has him pepper his thoughts with the self-instruction "Idea for story", which almost always prefaces a banal observation; he is unlikely, we feel, ever to make it as a writer of fiction.)

Throughout, White himself takes a back seat, allowing his stories-within-stories to play themselves out in leisurely fashion. He does not, however, restrain himself when it comes to the playful explicitness of his imagery, which gives a palpable sense of a writer really enjoying himself. Early on in his sexual career (and career it is), Jack, seized by "canine rapture", reflects that "this blend of patchouli and boy mud was the most intoxicating scent, the true smell of modernity"; revelling in the sexually and socially transgressive delights of his extramarital affair, Will permits Pia to "hold my cock at the base like a throttled child, and to lick the head with thorough care, almost (to change the image) as if it were a doll's head that she was painting with her tongue, determined to cover every last centimetre".

Jack Holmes and His Friend is an impressive and thoroughly enjoyable novel, although far from a perfect one: its two female characters, debutante Alex and slutty Pia, resemble cardboard cutouts with convenient characteristics grafted on to them; White refers obliquely to Jack's disastrous childhood too much for us to ignore and too little for it to be of genuine interest; and the book ends in a stagey fashion that diminishes what has gone before. But the peculiar, individual and persistent nature of Will and Jack's friendship is its great strength, and one that marks White out as an immensely gifted chronicler of the intricacies of the human heart.