On the outskirts of Herat, a girl named Mariam lives with her embittered and estranged mother, Nana. Mariam's father, Jalil, is a businessman who owns a cinema and lives in Herat with his three wives and nine children, but his affair with Mariam's mother led to him sweeping her under the rug by building her a small hut outside of the city, relegating her to it. Nana resents Jalil for his mistreatment of her and deceptive attitude towards Mariam. Jalil travels to visit Mariam, his illegitimate daughter, every Thursday. On her fifteenth birthday, Mariam wants her father to take her to see Pinocchio at his movie theater, against the pleas of her mother. Jalil promises to do so. When he does not come, she travels to his house in Herat and sleeps on the street outside after Jalil's doorman refuses to let her in, claiming that Jalil is busy. Later, she storms into the house and sees her father, but Jalil's chauffeur drives her back home. Upon returning home, Mariam finds that her mother has committed suicide out of fear that her daughter had deserted her. She is taken to live in Jalil's house, but his wives push him to quickly arrange for Mariam to be married to Rasheed, a shoemaker from Kabul who is thirty years her senior. Mariam resists, but is soon pressured into the marriage, moving away with Rasheed. In Kabul, Rasheed is initially kind and waits for her to adjust. However, as Mariam becomes pregnant and miscarries multiple times, their relationship sours, and he becomes increasingly moody and abusive over her inability to bear him a son.
Meanwhile, a younger girl named Laila grows up in a neighboring house in Kabul. She is close to her father, a kind-hearted teacher, but worries over her mother, who is depressed and unresponsive following her two sons' death in the army. Laila is also close friends with Tariq, a neighbor boy, but their friendship is increasingly frowned upon by others as they grow older; in spite of this, they develop a secret romance. When Afghanistan enters the war and Kabul is bombarded by rocket attacks, Tariq's family decides to leave the city, and the emotional farewell between him and Laila culminates in them making love. Laila's family eventually also decides to leave the city, but a rocket destroys their house as they are preparing to leave, killing her parents and severely injuring Laila. She is subsequently taken in by Rasheed and Mariam.
As Laila recovers from her injuries, Rasheed expresses interest in her, to Mariam's dismay. Laila is also informed that Tariq and his family have died on their way out of the city. Upon discovering that she is pregnant with Tariq's child, Laila agrees to marry Rasheed to protect herself and the baby, giving birth to a daughter, Aziza, whom Rasheed rejects and neglects for being a girl. Jealous of Laila and Rasheed's interest in her, Mariam initially is very cold, but gradually warms Laila as she attempts to cope with both Rasheed's abuse and the baby. The two become close friends and confidants, formulating a plan to run away from Rasheed and leave Kabul, but they are soon caught. Rasheed beats them both, locking them up separately and depriving them of water, almost killing Aziza.
A few years later, the Taliban rises to power and imposes harsh rules on the Afghan population, severely curtailing women's rights. In a women's hospital that has been stripped of all supplies, Laila is forced to undergo a C-section without anesthesia to give birth to Rasheed's son, Zalmai. Laila and Mariam struggle with raising Zalmai, who Rasheed dotes on and favors greatly over Aziza. There is a drought, and living conditions in Kabul become poor. Rasheed's workshop burns down, and he is forced to take other jobs. He sends Aziza to an orphanage, and Laila endures a number of beatings from the Taliban when caught alone in attempts to visit her daughter.
One day, Tariq appears at the house and is reunited with Laila, who realizes that Rasheed had hired the man to falsely inform her of Tariq's death so that she would agree to marry him. When Rasheed returns home from work, Zalmai tells him about the visitor. Suspicious of Laila and Tariq's relationship, Rasheed savagely beats Laila. He attempts to strangle her, but Mariam intervenes and kills him with a shovel, telling Laila and Tariq to run. Afterward, she confesses to killing Rasheed in order to draw attention away from them and is publicly executed. Laila and Tariq leave for Pakistan with Aziza and Zalmai, and spend their days working at a guest house in Murree, a summer retreat.
After the fall of the Taliban, Laila and Tariq return to Afghanistan. They stop in the village where Mariam was raised and discover a package that Mariam's father left behind for her: a videotape of Pinocchio, a small sack of money, and a letter. Laila reads the letter and discovers that Jalil had regretted sending Mariam away, wishing that he had fought for her. Laila and Tariq return to Kabul and use the money to repair the orphanage Aziza had stayed in, where Laila starts working as a teacher. She becomes pregnant with her third child, and if it is a girl, vows to name her Mariam.