I have noticed that when I eat something sweet, then afterwards, I eat something else that is sweet, the second sweet food is not as sweet as it usually is. I am pretty sure many others have a similar experience before too. Why does this happen?
What you describe is an example of neural adaptation, whereby neural response to a consistent stimuli becomes reduced with repetition. This occurs not just with sweetness (as shown empirically in this study on sucrose consumption by rats), but with many other types of stimuli (the feeling of clothes on your skin, the particular smell of your own home) as well.
In general, our senses are tuned to detect relative changes in our environment rather than absolute values. For example, if I were to place an unmarked 10 kg weight in one of your hands and a 12 kg weight in your other hand, you might have some trouble telling me what the exact mass of each weight is. You would have no trouble whatsoever telling me which weight was heavier. Neural adaptation allows us to maintain the ability to make these kinds of distinctions over a wide range of stimuli intensities.
There is no scientific consensus as to the exact mechanism of neural adaptation (and there probably isn't just one), but there are many candidate processes at the level of individual neurons, such as long term depression. Grill-Spector et al published a widely cited paper a few years ago called "Repetition and the brain: neural models of stimulus-specific effects" in which they put forth several potential mechanistic models of neural adaptation.