Since famine is what happens when there is not enough food for all the people, the best way to stop having famines is to grow more food. This is exactly what happened in the 18th century -- the Europeans learned to grow more food.
There were a couple of major types of improvments. First, there was a continuing movement away from the open field system where a whole village of farmers cultivated small individual strips of common land. This was a wasteful system and doing away with it improved productivity.
In addition, there was a great deal of technological improvement. For example, there was the invention in 1701 of the seed drill. This made planting much easier and efficient and, thereby, increased productivity.
Improvements like this meant more food could be grown and that led to a decrease in famines.