Klara, the narrator of the novel, is an Artificial Friend (AF), which means that she’s a special type of solar-powered robot that is sold to help assist with raising children. She begins her life in a store run by a human woman that she calls Manager. The store is located in a city somewhere in the United States in the near future. Though Klara is not the most advanced model of robot in the store, Manager notices that Klara is very observant. In particular, Klara likes looking out the window onto the street, where she can see the people outside in the Sun. She is dismayed whenever she sees the Cootings Machine, a construction vehicle that spews pollution that blocks the Sun. One day, Klara witnesses a man on the street—whom she calls Beggar Man—stop moving. He seems to be dead, but he’s resurrected the next morning when the Sun comes out. Watching this happen convinces Klara that the Sun has the ability to heal and nourish humans.
Klara is one of the last robots of her kind to be sold at the store. Eventually, however, she is purchased by a 14-year-old girl named Josie and her mom, whom Klara refers to as the Mother. Josie promises to buy Klara the day they meet, but it takes a long time until that day actually comes because Josie is delayed by her chronic illness.
Josie’s house is located in a more remote, rural area. At Josie’s house, Klara is happy to learn more about Josie and how she can be a good Artificial Friend. One of the most important people in Josie’s life is Rick, her neighbor and best friend. Rick has an aptitude for engineering, and he and Josie plan on spending the rest of their lives together. This plan faces one significant obstacle, however: Josie has been “lifted” and Rick hasn’t. Lifting is a procedure that supposedly makes children smarter and better prepared for the future, but it also carries potentially deadly side effects—lifting is the cause of Josie’s chronic illness. Because Rick hasn’t been lifted, most colleges won’t accept him, and so it is likely that he and Josie will have to be apart when Josie goes to college.
As Klara spends more time with her new family, the Mother asks Klara to learn as much as she can about Josie and even to try imitating her sometimes. Klara slowly learns that Josie is having a “portrait” made of her by an eccentric man named Mr. Capaldi. As it turns out, the portrait is not a painting but a near-exact AF replica of Josie’s body. Klara thinks perhaps she is intended to train the new Josie if the old Josie should ever die, but she soon learns that she has been chosen for her powers of observation to become Josie and to try to “continue” her as if the real Josie were still alive. Josie’s dad, the Father, objects to this plan, and even the Mother has doubts about whether she could ever accept a new version of Josie. Klara determines to do everything she can so that nothing bad ever happens to the original Josie.
Klara remembers how the Sun seemed to help Beggar Man, and so she calls on the Sun to help Josie get better. With Rick’s help, she goes to McBain’s barn, which is behind Josie’s house and which, from the vantage point of Josie’s window, looks like it’s located at the place where the Sun sets on the horizon. Klara promises the Sun that Josie and Rick have a true love and that they deserve the Sun’s help. She also promises that she will do something to please the Sun. When she’s in the city, she enlists the help of the Father (who is an engineer) to destroy a Cootings Machine, hoping that if she removes this source of pollution, the Sun will be happy. Klara is disappointed, however, to see that as they leave the city, the destroyed Cootings Machine has simply been replaced by a newer, bigger one.
Nevertheless, Klara continues to trust the Sun. One morning, her faith is seemingly rewarded. Though Josie’s health initially takes a turn for the worse, on one sunny morning, Josie begins making a miraculous recovery. Even Rick, who is more skeptical than Klara about the Sun’s power, later mentions that it really seems like Josie’s recovery was related to that one sunny morning.
After Josie recovers, she begins to drift apart from both Klara and Rick, spending more time with other young people in her area who are also headed to college. Rick begins to make his own new friend group. When Josie leaves for college, she says goodbye to Klara for the last time.
Klara eventually ends up in the Yard, a place where other AFs go to have their “slow fade” at the end of their lifespans. Klara becomes immobile, and although people offer to move her closer to other AFs, she prefers to be alone so that she can organize her old memories. One day, she is visited by Manager, who sometimes stops by the yard to check for out-of-commission AFs that she once sold at her store. Klara tells Manager about the time when the Sun was kind to Josie, and Manager says she always knew that the Sun would be good to Klara.