The book opens with "The Different Rules of Summer," in which we meet both boys for the first time. It is 1987, and Aristotle "Ari" Mendoza does not know what on earth he is going to do with himself all summer. He lives with his family but feels disconnected from them. He has two older sisters, but they have moved out already. His older brother is in prison and nobody is allowed to mention his name. This is a family that clams up about things they don't want to think about; Ari's father is a Vietnam veteran but he won't talk about his experiences in the war either. Ari is so desperate to get out of the house that he goes to the community swimming pool to hang out, which would be a normal teen boy thing to do, except for the fact that he can't swim.
At the pool, he meets a boy named Dante Quintana. Dante is a talented swimmer and he offers to teach Ari how to swim. They become fast friends, and bond over their classical names. Ari is fascinated by Dante, and a little in awe of him because he swims so well and knows so much about art and literature. Like Ari, Dante is Mexican American and this leaves him in a permanent state of ambivalence because he doesn't know how to embrace his Mexican heritage and his American nationality at the same time. Dante's family members are close-knit and openly affectionate towards each other, which astounds Ari because his family is completely the opposite.
Ari gets a terrible case of the flu and begins to have some strange and terrifying dreams in his feverish state. In one dream it is pouring down with rain, he is alone and he can't find Dante or his father even though he is searching everywhere for them. He also dreams about his brother who is in prison. In his dream, his brother is standing across from him on the other side of the river and Ari is shouting to him that he wants him to come back home. Even though he recovers from the flu, Ari continues to have the same kind of dreams, which are all dreams in which he is on his own and abandoned by the people he cares about.
Dante tells Ari that he and his family are moving to Chicago for a little while because his dad has been offered a new job there. That same day, the boys try to rescue a bird that is lying injured in the middle of the street. Dante is almost hit by a car that comes speeding around the corner, but Ari pushes him out of harm's way, getting hit by the car himself, and becoming very seriously injured. Both of his arms and one of his legs are broken and in casts. Dante feels overwhelmed by guilt because he has barely a scratch on him, thanks to Ari. Ari's accident does have one surprising and positive side effect, though: the Mendozas and the Quintanas become close as families, and both of the boys' mothers talk regularly about their sons. Dante begins therapy to help him come to terms with the accident and to try to work through his feelings of guilt.
Ari, meanwhile, is becoming an angry young man. When Dante gives him his sketchbook to look at—a large gesture since he never allows anyone to look at it—Ari is furious because he thinks Dante is only being nice to him to assuage his own guilt. He also refuses to consider therapy or counselling. He tells his mother that he will start talking about his feelings when she starts talking about hers, and that starts with talking about his brother. Ari is also surprised when his accident proves to be a bonding experience between him and his remote, quiet father. His dad visits him every evening and they read together, which Ari believes is the equivalent of other fathers and sons talking to each other.
Ari's father wants to buy Ari a car for his birthday, and Ari requests a beat-up old pick up which he loves. He's becoming more independent again and less reliant on others to do simple things like help him bathe and write things down. This makes his spirits rise, but he is still dreading the upcoming school year because Dante will be in Chicago, and he will be friendless again. Dante confesses to Ari that more than anything else in the world he loves swimming and Ari, but Ari is a little freaked out by this admission and tells him that he shouldn't talk like that.
School starts; Ari doesn't want to talk about his accident, but finds that his female classmates, in particular, can be relentless in asking for details and information. The chief offenders in this are Gina Navarro and Susie Byrd, who both seem to like him a lot, but Ari is not interested in them because he has an obsessional crush on a girl called Illeana, and all he can think about is kissing her.
As promised, Dante keeps in touch. His letters tell of a social whirlwind of a life in Chicago where he's been going to lots of parties and has tried marijuana, alcohol and kissing girls. He has also enjoyed Chicago's culture and writes of visits to the Art Institute and seeing his favorite paintings. A few letters into his Chicago stay and he confesses that although he's been kissing lots of girls he likes kissing boys a lot more. When Ari finally gets the cast taken off his leg, he walks by Dante's house, where he finds a stray dog that he calls Legs. Without Dante, he finds a routine very quickly, consisting mostly of driving lessons and running with his dog. He is also trying to find out as much as he can about his brother at the library, because nobody will tell him anything about him. He gets a part-time job in a burger restaurant. He keeps a journal and writes every single thing down.
Christmas brings a surprising gift. Ari finds an envelope with "Bernardo" written on it and immediately knows that the answers to all of his questions about his brother are to be found inside, which makes him afraid to open it.
New Year's Eve comes, and finally Ari gets his first kiss from Illeana, but it's a short-lived relationship because she tells him that she already has a boyfriend, and he is in a gang. Later Ari learns that she has dropped out of school because she's pregnant and has to get married to the boy in the gang she had told him about.
Dante tells Ari in his next letter that he still likes to kiss boys. He's worried what his parents will think and say when they find out.
Finally, the last day of school comes, and Ari celebrates by getting drunk in the desert with Gina and Susie. He has secured a job at the Chamber of Commerce for the summer, but when Dante returns, the boys pick up their close friendship exactly where they had left off. Dante tells him that his mom is pregnant, which he is relieved about because if she has a boy then he can grow up to be attracted to women, get married, and have a child, which would definitely take the pressure off of Dante. Ari tells Dante he has his full support, always, but he doesn't want to kiss him. However, he admits to Ari that he hasn't actually kissed another boy, he just wants to. He wants to kiss Ari just to see what it feels like, and although he doesn't really want to go along with this experiment, Ari agrees. Afterward, he claims that he didn't feel anything different or special at all, but Dante is upset by this. He did feel something and this confirms that he really does have feelings for Ari that go beyond friendship.
Ari is discovering that his parents are quite different from how he had thought of them. His Aunt Ophelia has a stroke and passes away, and when they arrive at her house, Ari can remember living with her as a small child. When he asks his father about this, his father is surprisingly forthcoming with information, and tells him that he lived with Aunt Ophelia when his brother was on trial. His mom found it so stressful that she had a nervous breakdown, and Ophelia looked after Ari until his mother was able to take care of him again. At the funeral, Ari realizes they are are the only family members there, and his parents reveal that Aunt Ophelia was shunned by the rest of the family because she was gay, and lived with another woman. They cannot believe she is being judged like this and it upsets them very much to see a good person marginalized for their sexuality. On the way home from the funeral they finally tell Ari about his brother.
Bernardo was arrested for murder. When he was fifteen he paid a hooker for sex. She turned out to be he; when Bernardo found out he had just had sex with a trans person he was enraged and killed the prostitute with his bare hands. He received a life sentence.
When they arrive home, Dante's father is waiting for them to tell them that Dante is in the hospital after being beaten up by a group of thugs who saw him kissing Daniel, a boy from his place of work. Ari goes to the pharmacy and confronts Daniel who eventually tells him the names of the thugs who beat up Dante. He goes to the body shop where Daniel says they work and beats up a young man called Julian in retaliation. He almost gets in a lot of trouble for this, but his father stands by him and gets him out of it. His mother is worried that he is going to turn out like Bernardo and that he is developing a violent streak, or a hateful streak, but when he explains that he only beat up Julian because he had attacked Dante for his sexuality, she understands, and seems to also see something in Ari that he has yet to see in himself.
Mr. Quintana asks Ari if he has any idea why Dante was beaten up. Ari outs Dante to his father, and then explains that Dante hadn't come out to his parents yet because he was worried how they might react. The Quintanas are entirely supportive and Mr. Quintana tells Ari he had already guessed that Dante was gay, because he sees the way he looks at Ari. Mrs Quintana is already sure that Dante is in love with Ari. Ari admits that this used to be true, but that Dante has moved on and is infatuated with Daniel.
Daniel begins to visit Dante at his house when he is released from the hospital, which makes Ari angry, since Daniel was nowhere to be seen whilst Dante was getting beaten up. Dante tells Ari that when he is kissing Daniel he closes his eyes and pictures Ari instead. He is very hurt when Ari rebuffs him.
The new openness in Ari's family is rubbing off on his parents. His mother makes his father tell Ari about the experiences in the Vietnam War that have haunted him his entire life. Mr. Mendoza then tells Ari to stop running away from the fact that Dante is in love with him; they all know it's true, and that Ari is running away from the fact he loves Dante in the same way. Ari is ashamed of loving another man but his parents are proud of him, and of the genuine and true love that he already shows for Dante. Dante goes bowling with Ari and his parents that night, and afterwards, Dante tells Ari they can't be friends anymore, because being "just friends" is too difficult for him. Ari admits he lied when he said their kiss did nothing for him and suggests that Dante kisses him again. Dante refuses. He wants Ari to initiate the kiss instead, and Ari does, without missing a beat.
Ari realizes he was looking for the secrets of the universe outside of himself but had the answers within him all the time. He has been in love with Dante since the moment they met, but was afraid of his feelings and like the rest of his family, put them away and hid from them.