Buffy and Riley fought demons together and continued saving each other's lives, and the world, right up until his departure in the Season Five episode Into the Woods, in which Buffy learned that Riley was allowing vampires to suck his blood, apparently because he enjoyed being needed, and felt that Buffy never did need him. The resulting breakup caused Riley to leave Sunnydale to join another army unit fighting demons elsewhere.
Riley returned in the Season Six episode As You Were, where he showed up unexpectedly, tracking a demon about to hatch eggs that could wipe out Sunnydale. However, he did not return to make things up with Buffy, having recently gotten married. The battle done, Riley left Sunnydale, never to return again.