This particular line of text comes in the final moments of the story. Buttercup and Westley are making flirtatious little jokes with each other and making light of the fact that Westley has already died once for Buttercup and her love. At one point Buttercup says that she and Westley are "doomed" to be together until one of them dies. Westley isn't happy with that thought, because it means their love will end when one of them dies. He wants their love to live on forever, so he jokes that their love will never end if neither of them dies. Buttercup isn't sure that is possible, and Westley confidently states that they will never die if they promise to outlive each other. If each person makes the promise to outlive the other person, that means neither person can die; therefore, they are just as eternal as their love.
"To be together. Until one of us dies."
"I've done that already, and I haven't the slightest intention of ever doing it again," Westley said.
Buttercup looked at him. "Don't we sort of have to sometime?"
"Not if we promise to outlive each other, and I make that promise now." Buttercup looked at him.
"Oh my Westley, so do I."
Westley and Buttercup promise to outlive one another so they'll never, ever have to be apart. Their love is deep. Westley's devoted to Buttercup from the very start, when he works as a farmhand for her parents. His response to everything Buttercup asks of him, or even just says to him, is "As you wish"—and he means it. He'll do anything for her. He'll chase her up the Cliffs of Insanity. He'll die at the hands of Prince Humperdinck and get resurrected by Miracle Max.
Buttercup doesn't fall head over heels for Westley right away. At first, she's bossy and dismissive. She assumes Westley isn't very bright because he doesn't say much, and she doesn't appreciate him. Once Buttercup has some competition, however, in the form of the Countess, Buttercup sees Westley with fresh eyes and recognizes that he's smart, attractive, and utterly devoted to her.