My Minecraft starts freezing after playing for a while. Why is this so?

After playing for maybe an hour or so, my Minecraft starts freezing very frequently and I have to restart my game. But every time I restart the game, the amount of time that it remains smooth becomes shorter. Can anybody explain this? Could it be my battery, or maybe RAM, or something else? Anyone experienced this before?

I think it's the RAM and the computer being put through too much that it overheats. Try clearing space on your computer