The 49ers prevailed in a back-and-forth affair, led by Brock Purdy's five touchdowns. San Francisco remains in the hunt for the NFC's No. 1 seed.