When a gamma ray is emitted from the nucleus of an atom it reduces the overall energy of the nucleus. Emission of gamma rays almost happens along with beta and alpha emissions. After the two emissions, the nucleus of the atom would still be in an excited state. To achieve stability, gamma rays are emitted which will decrease the overall energy of the nucleus.