A tongue-in-cheek bedtime book for parents which exhorts children to "go the fuck to sleep" has soared to the top of Amazon's bestseller chart a month before publication.

Written by novelist Adam Mansbach after his own daughter Vivien failed to nod off one night, the book, Go the Fuck to Sleep, combines cutesy rhymes with expletive-ridden pleas. Published by small US press Akashic Books, it was originally due out in October. But after a pirated PDF went viral, striking a chord with exhausted parents and catapulting the 32-page book to the top of Amazon.com's bestseller chart – ahead of memoirs by Tina Fey and Steven Tyler – it has now been pulled forward to June.

"The eagles who soar through the sky are at rest / And the creatures who crawl, run and creep. / I know you're not thirsty. That's bullshit. Stop lying. / Lie the fuck down, my darling, and sleep," writes Mansbach in the book, illustrated by Ricardo Cortes. "The cubs and the lions are snoring,/ Wrapped in a big snuggly heap. / How come you can do all this other great shit / But you can't lie the fuck down and sleep?"

Film rights have now been optioned by Fox 2000, and Canongate has snapped up UK rights in the title. It's "definitely not a book to read to your child", said the publisher, but "it will resonate with anyone who has ever spent 20 minutes, 40 minutes, four hours reading 'just one more bedtime story'."

"For me and many parents the Gina Ford sleep routine never quite worked," said Canongate editor Francis Bickmore, a father of two. "Bedtimes are precious but occasionally precarious times and I wish someone had given me this hilarious book sooner. It's an essential gift for any parent you know who lives in the real world."

Vivien is now three, and Mansbach says that she is sleeping better. "Initially the audience was me and my wife," he told the Associated Press. "It captures the frustration of being in a room with a kid and feeling like you may actually never leave that room again, that you may spend the rest of your life in that dark room, trying to get your kid to go to sleep."