Jared Goff threw three touchdown passes and the Detroit Lions tuned up for their Week 18 division showdown against Minnesota by beating the San Francisco 49ers 40-34 on Monday night.