The NeverEnding Story II: The Next Chapter
(bolding mine)
Bastian Balthazar Bux seeks to join his school's swimming team, but his ability to jump off a diving board is marred by his acrophobia (fear of heights). He revisits Carl Conrad Coreander's antiquarian bookstore to seek advice on courage, where he rediscovers the Neverending Story and hears the Childlike Empress call out to him for aid. Bastian takes the book home while the Auryn amulet magically comes off the book cover which Bastian takes and is summoned to Fantasia, where he meets a bird-like creature named Nimbly and is reunited with Atreyu. After the group encounters and escapes from giants, Bastian comes to understand that a force called "Emptiness" is spreading across Fantasia. This force has been brought about by the evil sorceress Xayide, who seeks to seize power over Fantasia. To hinder Bastian's quest, Xayide's inventor Tri-Face develops an apparatus that strips Bastian of a memory each time he uses the Auryn amulet to make a wish. Nimbly was sent as a spy to persuade Bastian to make wishes until he is unable to remember why he came to Fantasia.
....
Atreyu determines what Xayide is planning, while Bastian is fully persuaded that Atreyu has turned on him. In a struggle between the two, Atreyu is knocked over a cliff and falls to his death. Returning to Xayide, Bastian discovers the apparatus for himself and learns that he only has two memories left, consisting of his mother and father. Bastian uses his penultimate memory of his mother to wish Atreyu back to life. Xayide tries to force Bastian to use his last wish to return home. Bastian agrees to do so, but wishes for the sorceress "to have a heart" instead. This fills Xayide with emotion, negating the Emptiness within her and which she controls. Overcome with compassion, Xayide explodes in a blast of light, and Fantasia is restored. Having been freed, the Childlike Empress thanks Bastian for his help while Bastian gives her the Auryn amulet and shows him the way home: a cliff overlooking a waterfall to help Bastian overcome his fear of heights. Encouraged by Barney and Atreyu, Bastian jumps off and returns home safely while the Auryn amulet magically goes back onto the book cover.