By Chris Adrian

Farrar Straus Giroux. 292 pp. $26

Stealing from Shakespeare, as the Bard himself would admit, is no crime. In his new novel, “The Great Night,” Chris Adrian takes characters and broad structural plotlines from “A Midsummer Night’s Dream” to write a kind of sequel to the play, giving a twist to all its familiar elements.

The scene is shifted from the court and forest around Athens to Buena Vista Park in contemporary San Francisco. Taking the part of the four star-crossed lovers are three people, each suffering from heartbreak, lost in the woods. Instead of the rough countrymen putting on a production of “The Tragedy of Pyramus and Thisbe,” a group of homeless men and women is mounting a musical comedy version of “Soylent Green.”

And 400 years after they first appeared as the faerie queen and king, Titania and Oberon have been relocated to an underground hideaway, attended by Puck and a new cast of faeries. The novel’s action begins, as does the play, with Titania and Oberon fighting over a changeling boy.

In Shakespeare’s comedy, the changeling is but a plot device, a means to incite Oberon’s jealousy over the attention paid to the boy by Titania. But in Adrian’s version, the changeling becomes much more of a central figure. Titania falls in love with the mortal child, especially after the boy is stricken with leukemia. In the most moving part of the book, Titania and Oberon watch over the toddler as he undergoes months of treatment in a cancer ward.

Adrian’s remarkable talent for capturing telling moments is on display in this poignant chapter. Frustrated by his wife’s spoiling of the boy, Oberon instructs him to pick up his blocks and put them in a bucket, but the changeling instead takes the handle in his mouth and pretends he is a puppy. Titania walks in on the two of them, playing on the floor, her husband with a plastic shovel in his mouth. “Titania laughed, and it seemed to her in that moment that she had two hearts in her, each pouring out an equivalent feeling toward the prancing figures, and she thought, My men.”

Grief-stricken by the child’s death, Titania drives her husband away, but on the midsummer night in question, she summons Puck to go search for Oberon. For those who remember the play, with its comedy of mistaken lovers brought to harmony, this novel’s heartbreak and loss are jarring, but more startling still is the characterization of Puck. In “A Midsummer Night’s Dream,” he is the trickster who powers the antic mischief and mistaken identity that make the play one of Shakespeare’s most beloved comedies. But Adrian has other plans for Puck, making him a figure of true mayhem and destruction.

That dissonance with the original undermines Adrian’s considerable powers. Moments of comedy — from slapstick to farce — exist in the novel, but they are mixed with graphic violence and anonymous sex. Rather than ending upon a dream, “The Great Night” aches with lost love and the torturous ordeal of childhood caught between innocence and awakening.

For a novel based upon a classic comedy, it’s devastating. The intertwined stories of the three young San Franciscans are at the heart of the sadness. There is Will, the tree surgeon whose wife has left him; Molly, raised a Christian fundamentalist, who is coping with the loss of her boyfriend; and most prominently, Henry, a pediatrician, recently rejected by his boyfriend. The mood darkens as the night unfolds, and it becomes increasingly difficult to reconcile the adaptation with the spirit of the original. One’s appreciation for the rustics’ musical “Soylent Green” depends upon how you react to lyrics such as “People who eat people are the loneliest people in the world!”

Adrian takes great imaginative risks in his writing. His novels “Gob’s Grief” and “The Children’s Hospital” and his collection of short stories, “A Better Angel,” (which also features a story called “The Changeling”) have been widely praised for their courage and linguistic dexterity. Last summer, he was included on the New Yorker’s 20 Under 40 list of exciting new writers. A graduate student at the Harvard Divinity School and a fellow in pediatric hematology-oncology at the University of California San Francisco, he clearly knows the sorrow of the human comedy and what fools we mortals be. Brush aside your Shakespeare, and you will find the same in “The Great Night.”