By employing the general expression of temperature Th=∣κ∣/2π=2πr~A1(1−2Hr~Ar~˙A) associated with the apparent horizon of a FRW universe and assuming a region of FRW universe enclosed by the apparent horizon as a thermal system in equilibrium, we are able to show that the generalized second law of thermodynamics holds in Gauss-Bonnet gravity and in more general Lovelock gravity.