Ella, a woman about to turn 40, lives with her family in Northampton, Massachusetts. She has been married to her husband David, a successful dentist, for 20 years, and they have three children: Jeannette, Avi, and Orly. But while Ella’s life seems successful on the outside, she slowly comes to realize that her life is lacking love.
One day, the prestigious literary agency Ella works for part-time assigns her to read part of a manuscript for a novel called Sweet Blasphemy by first-time novelist A. Z. Zahara. She is instantly enchanted by his historical novel about the spiritual encounter between the famous poet Rumi and his companion Shams in the 13th century. Shams is an unconventional Sufi mystic who has come up with his own 40 rules for love, and these rules prompt Ella to ask questions about her own life and realize how lacking in love it is. As Ella reads more of Sweet Blasphemy, she becomes increasingly obsessed with the life of its author, corresponding with him via email and learning that he goes by Aziz.
In between sections that narrate Ella’s story, The Forty Rules of Love focuses on the story at the center of Aziz’s novel. In Sweet Blasphemy, Shams is an unconventional dervish (an ascetic religious figure in Sufism, similar to a monk) who is clearly gifted but who struggles to fit in with the others at Baba Zaman’s dervish lodge. One day, Baba Zaman gets a letter that the esteemed Rumi is looking for someone to go on a spiritual journey with him, and Shams volunteers right away, in spite of knowing that assignment could be dangerous. He is willing to be like a silkworm who sacrifices his own life to become part of a larger, beautiful silk scarf.
When Shams meets Rumi in Konya, where Rumi lives, the connection is immediate, and the two of them often spend long hours together in the library discussing spiritual issues. While Rumi feels like the experience is reinvigorating for him, helping to break him out of old routines, some in town fear that Shams may be a heretic who is leading Rumi down the wrong path.
One of Shams’s harshest critics is Rumi’s own son, Aladdin. Aladdin thinks that Shams is a heretic for challenging Aladdin and later Rumi himself to drink wine, which is forbidden in Islam. Shams replies that Aladdin is too focused on reputation and external appearances, and he needs to have more faith.
Meanwhile, in Ella’s story, Ella continues to grow apart from her husband, David. One day at dinner, he confronts her about the emails that she’s been exchanging with Aziz, which he sees as an affair. Ella finally challenges David to explain all the details she herself has witnessed of his affairs. Things escalate until eventually Ella admits to David that she loves Aziz. Later, she tells this to Aziz himself, and the two of them make plans to meet up when he is in Boston.
In Sweet Blasphemy, which Ella continues to read, Shams’s presence in Rumi’s life becomes more controversial. Although people like the heavy drinker Suleiman and the former sex worker Desert Rose come to see the wisdom of Rumi, Rumi alienates people like Sheikh Yassin, who is furious at the way Shams has upended the traditional order in Konya, all with Rumi’s encouragement.
Things come to a head when several local people hire the notorious assassin Jackal Head to murder Shams in the courtyard of Rumi’s house. Shams seems prepared for the moment, but Jackal Head and all the conspirators overwhelm Shams and eventually kill him. Rumi hears the commotion and is distraught to learn that Shams is dead—and that his own son Aladdin seemed to play a role in the assassination plot. Rumi spends many years coming to terms with his grief, and he goes on to write some of the most famous poems of his career about this grief.
Meanwhile, in the real world, Ella and Aziz finally meet for the first time in Boston. Ella is nervous at first about what it will be like to be with Aziz, particularly because she still loves her children. But Aziz’s presence helps put Ella at ease. He confesses to her that he has a terminal illness and won’t live much longer, but he says that if she is willing, she can come live with him in Amsterdam. Ella agrees, packs her things, and leaves her family to be with Aziz.
Later, Ella and Aziz go on a trip to present-day Konya, the city where Rumi and Shams once lived together. All of a sudden, Aziz collapses. He is taken to the hospital and dies shortly after. Ella is full of grief, but she doesn’t give up on her mission to try to live a life rich with love and intention.