Please don’t do this. Don’t write a novel about trying to write a novel. It’s cliche and insular and lazy. Just don’t do it.

Unless it’s this novel — this wonderful, witty, heartfelt novel by Lily King titled “Writers & Lovers.”

I’ve followed King’s career since her debut two decades ago, when she published “The Pleasing Hour” about an American au pair in Paris. With “The English Teacher” (2005) and especially “Father of the Rain” (2010), she established a reputation for writing insightful, emotionally piercing stories. But she never attracted the audience she deserved until she left the confines of domestic fiction and published “Euphoria” (2014), a wry historical novel about Margaret Mead in New Guinea.

That change must have felt to her like a risk, but it was not nearly as reckless as what she’s up to now. “Writers & Lovers” is a funny novel about grief, and, worse, it’s dangerously romantic, bold enough and fearless enough to imagine the possibility of unbounded happiness. According to the penal code of literary fiction, that’s a violation of Section 364, Prohibiting Unlawful Departure from Ambiguity and Despair.

Run, Lily, run!

The narrator of “Writers & Lovers” is Casey, a 31-year-old woman clinging to her dream of a creative life after all her MFA friends have settled down, married up and sold out. One by one, they’ve succumbed to law or engineering school. A promising writer she used to room with has become a real estate agent, but she tries to convince Casey that she still uses “her imagination when she walked through the houses and invented a new life for her clients.” Rest in peace, dear friend.

When the novel opens in the 1990s, Casey is living alone in a converted potting shed in Cambridge, Mass. She wants to be a writer — she is a writer! — but most days the manuscript she’s toiling over feels clogged and doomed. The phrase “I am wasting my life” thumps through her body like a heartbeat. She works as a waitress at an upscale restaurant owned by a Harvard social club to cover her rent and payments on $73,000 of student debt. “All I can do now is manage it, pay the minimums until — and this is the thing — until what? Until when?” she asks. “There’s no answer. That’s part of my looming blank specter.”

This is a bracingly realistic vision of the economic hopelessness that so many young people are trapped in: serving extraordinary wealth but entirely separate from it. Casey has spent six years on her novel, barely supporting herself with an exhausting restaurant job that gives her horrible hours and no benefits. And like far too many artists, she’s ignoring a conspiracy of frightening bodily ailments because she can’t afford health insurance.

Giving up now would be sensible but demoralizing, an admission that all her past struggles were for nothing. Her landlord greets her one morning by noting, “I just find it extraordinary that you think you have something to say,” but that’s no more discouraging than her own internal doubts. Sitting at her desk later that day, she confesses, “I don’t write because I think I have something to say. I write because if I don’t, everything feels even worse.”

Feeling even worse is a constant threat. Her last boyfriend, Luke, was a poet who worried that “the Devil” might be behind their relationship while he wrote about bees and dead children. Now Casey’s alone again, trudging through a perpetual state of shock at the sudden loss of her mother. Her sorrow sends her into fits of crying, which the manager at the restaurant finds annoying.

I know: I’m doing a horrible job of making this novel sound funny or romantic. But this is the grim terrain that King lays out at the opening of “Writers & Lovers.” And it’s what makes the arc of this story so enchanting. All of these tragedies and obstacles are drawn with stark realism and deep emotional resonance. But even during the early pages, we can sense Casey’s spirit crouching in determined resistance:

“I have a pact with myself not to think about money in the morning,” she says. “I’m like a teenager trying not to think about sex. But I’m also trying not to think about sex. Or Luke. Or death. Which means not thinking about my mother, who died on vacation last winter. There are so many things I can’t think about in order to write.”

As in her previous novels, King explores the dimensions of mourning with aching honesty, but in “Writers & Lovers” she’s leavened that sorrow with an irreducible sense of humor. Her heroine experiences life in the weirdly bifurcated way that writers often do: feeling the pain while also harvesting it for comedy. As Casey endures the humiliations of poverty and the mistreatment of various suitors, her own wry commentary on life as a young woman in modern America is the only compensation that gets her through.

Now on her fifth novel, King has a lifetime of experience with the pressures and absurdities of being an aspiring writer — and a successful one. She’s also in a position to cast a knowing, satiric eye across the whole enterprise of fiction workshops, graduate seminars, bookstore readings and publishing parties. Casey endures the condescension of insecure, egotistical men who “wrote tender, poetic sentences that tried to hide the narcissism and misogyny of their stories.” Such acerbic insights ensure that “Writers & Lovers” isn’t just a novel for other writers. It explores a culture determined to shame young women’s sexuality, hobble their motivation and mock their ambition.

With Casey, King has created an irresistible heroine — equally vulnerable and tenacious — and we’re immediately invested in her search for comfort, for love, for success: a triple prize that seems entirely impossible. But as the story progresses, the desolation of pining for a partner flips into the chaos of balancing two fellow writers vying for her affections. That artistic anxiety and romantic strategy introduces a new set of pressures.

Jane Austen said, “Man has the advantage of choice; woman only the power of refusal,” but Casey is determined to hold out for a plot on her own terms. The result is an absolute delight, the kind of happiness that sometimes slingshots out of despair with such force you can’t help but cheer, amazed.

Ron Charles writes about books for The Washington Post and hosts

On March 30 at 7 p.m., Lily King will be at Politics & Prose, 5015 Connecticut Ave. NW, Washington, D.C.

Writers & Lovers

By Lily King

Grove. 324 pp. $27