To conclude the trilogy she began with 2003's A Great and Terrible Beauty, Libba Bray required coffee, chocolate, a coterie of writing buddies coaxing her on, a few all-nighters, and an “intervention” by her publisher to overcome a pernicious case of writer's block.

“I can honestly say I've never worked so hard on anything in my life. Not even labor. That was awful, but it was over in seven hours,” Bray said.

Despite the difficulties, The Sweet Far Thing (Delacorte) will release on Dec. 26. (In a starred review, PW praised it as “a huge work of massive ambition.”) At 832 pages, the third book is twice the length of the first, and showcases the breadth of Bray's reach—a hybrid of historical fiction and high fantasy, it incorporates Gothic horror, romance, and heady questions about empowerment, feminism—even workers' rights. It's funny, too. Bray's 19th-century characters are as fiercely witty as she is.

“The thing I really love,” said Holly Black, one of the stable of YA writers including E. Lockhart, Cassandra Clare, Maureen Johnson and others that Bray relied on, “is that she's made historical fiction really fresh, with strong women who have friendships that feel real so that young readers can find themselves in the story.”

Bray, who had written three novels under a pseudonym for 17th Street Productions, initially sold the series to Delacorte editor Wendy Loggia on a proposal. She signed the contract on Sept. 10, 2001.

“The next day was supposed to be my first full day at work on the book,” said Bray. Distractions, big and small, are the hobgoblins of many novelists, but for Bray, who lives in Brooklyn with her husband, literary agent Barry Goldblatt, and their son, concentrating on imaginary drama when real evil had been visited upon New York proved impossible.

Despite that rocky start—she didn't actually begin writing until 2002—the book arrived on schedule in December 2003 and was an immediate hit, embraced by teens who waited for the second installment, Rebel Angels, by reading Bray's often-hilarious blog (libba-bray.livejournal.com). The first two books have combined sales of more than 600,000 copies.

The Alabama-born Bray, who has a degree in theater from the University of Texas, also raised her profile—and the demands on her time—by demonstrating talent as a speaker. Accepting NAIBA's award for Best Young Adult Book of the year for Rebel Angels, she wowed the audience with an “Ode to Independent Booksellers,” which compared them to Iggy Pop. Her smooth job as emcee at BEA's Children's Book and Author Breakfast this past June displayed her out-there humor when, from the podium, she summarized the plot of her work-in-progress—in mime.

But those were rare days away from the computer. She had turned in a 540-page draft of The Sweet Far Thing in September 2006, but wasn't satisfied. “It was like when you take something out of the fridge and it looks fine but you know it would be a mistake to eat it.” Her editor, Wendy Loggia sent a 12-page revision letter, which Bray read and re-read while she toured that fall.

“She was able to distill that I had started in the wrong place emotionally,” Bray admitted. “So I changed that one thing, and the rest of the novel fell apart.”

With less than a year until the announced on-sale date, Bray started over, but struggled. Bray works at home, though she also puts in considerable writing time with “the gang on the couch,” at the Tea Lounge in her Park Slope neighborhood. Both the writers—who flock to the couch because it's close to the electrical outlets—and the baristas get high-fives in the new book's acknowledgments.

Bray's publisher, Beverly Horowitz, gently pulled the plug on that arrangement. “We took her to lunch and told her, 'We've got a new office for you,' ” Horowitz recalled. They set aside a small conference room, put Bray's name on the door, restricted visitors, but provided unlimited chocolate (Bray says she gained 25 lbs.), coffee and cheerleading. “It was an intervention, but in a good way,” Horowitz said.

Bray wrote at Random House every day for three months. “They knew I just needed to power through, that I had no compass anymore. My fear was so substantial, they could smell it.” In March—six months before the release date—she had a new 900-page draft. The release date moved to December.

Bray credits Loggia (whom she calls “St. Wendy of Loggia”) with keeping her calm. “She is Valium in human form, the Zen master.” She also says Black, who is also represented by Goldblatt, “talked her off the ledge” many times.

After turning in final edits, Bray made a 23-minute film she'll show at school visits next spring. (The baristas co-star.) She's helping son Josh with his third-grade homework. What she's not doing is planning her next trilogy. “I would never rule it out,” she said, “but right now it's like asking a woman who's just given birth when she's going to have her next baby.”