We study the decay phase of solar flares in several spectral bands using a method based on that successfully applied to white light flares observed on an M4 dwarf. We selected and processed 102 events detected in the Sun-as-a-star flux obtained with SDO/AIA images in the 1600 Å and 304 Å channels and 54 events detected in the 1700 Å channel. The main criterion for the selection of time profiles was a slow, continuous flux decay without significant new bursts. The obtained averaged time profiles were fitted with analytical templates, using different time intervals, that consisted of a combination of two independent exponents or a broken power law. The average flare profile observed in the 1700 Å channel decayed more slowly than the average flare profile observed on the M4 dwarf. As the 1700 Å emission is associated with a similar temperature to that usually ascribed to M dwarf flares, this implies that the M dwarf flare emission comes from a more dense layer than solar flare emission in the 1700 Å band. The cooling processes in solar flares were best described by the two exponents model, fitted over the intervals t1=[0, 0.5]t1/2 and t2=[3, 10]t1/2 where t1/2 is time taken for the profile to decay to half the maximum value. The broken power law model provided a good fit to the first decay phase, as it was able to account for the impact of chromospheric plasma evaporation, but it did not successfully fit the second decay phase.