system
Given the following post, respond as if you're commenting on Reddit:
human
eli5 : How did we measure the distance between the sun and the earth?
gpt
You have to start before that. The first distance to be measured with any accuracy was that of the Moon. In the middle of the 2nd century BCE, Greek astronomer Hipparchus pioneered the use of a method known as parallax. The idea of parallax is simple: when objects are observed from two different angles, closer objects appear to shift more than do farther ones. You can demonstrate this easily for yourself by holding a finger at arm's length and closing one eye and then the other. Notice how your finger moves more than things in the background? That's parallax! By observing the Moon from two cities a known distance apart, Hipparchus used a little geometry to compute its distance to within 7% of today's modern value.

With the distance to the Moon known, the stage was set for another Greek astronomer, Aristarchus, to take the first stab at determining the Earth's distance from the Sun. Aristarchus realized that when the Moon was exactly half illuminated, it formed a right triangle with the Earth and the Sun. Now knowing the distance between the Earth and the Moon, all he needed was the angle between the Moon and Sun at this moment to compute the distance of the Sun itself. Aristarchus estimated this angle to be 87 degrees, not terribly far from the true value of 89.83 degrees. But when the distances involved are enormous, small errors can be quickly magnified. His result was off by a factor of more than a thousand.

Over the next two thousand years, better observations applied to Aristarchus' method would bring us within 3 or 4 times the true value. There was still only one method of directly measuring distance and that was parallax. But, finding the parallax of the Sun was far more challenging than that of the Moon. After all, the Sun is essentially featureless and its incredible brightness obliterates any view we might have of the stars that lurk behind. 

Enter planetary relational distance and the key is the transit of Venus. Johannes Kepler and Isaac Newton had shown that the distances between the planets were all related; find one and you would know them all. During a transit, the planet crosses in front of the Sun as seen from Earth. From different locations, Venus will appear to cross larger or smaller parts of the Sun. Kind of like a planetary eclipse. By timing how long these crossings take, James Gregory and Edmond Halley (the comet guy) realized that the distance to Venus (and hence the Sun) could be determined.

This presented a small problem though. Venus is only in transit once a generation (though often come in pairs). By the time Halley realized that this method would work, he knew that he was too old to have a chance to complete it himself. So, in hope that a future generation would undertake the task, he wrote out specific instructions on how the observations must be carried out. In order for the end result to have the desired accuracy, the timing of the transit needed to be measured down to the second. In order to have a large separation in distance, the observing sites would need to be located at the far reaches of the Earth. And, in order to ensure that cloudy weather didn't ruin the chance of success, observers would be needed at locations all over the globe.

Despite these challenges, astronomers in France and England resolved that they would collect the necessary data during the 1761 transit. Although not all observers were successful (clouds blocked some, warships others), when combined with data collected during another transit eight years later, the undertaking had been a success. French astronomer Jerome Lalande collected all the data and computed the first fairly accurate distance to the Sun: 153 million kilometers, good to within three percent of the true value!

By the way, the number we're talking about here is called the Earth's semi-major axis, meaning that it's the average distance between the Earth and the Sun. Because the Earth's orbit isn't perfectly round, we actually get about 3% closer and farther throughout the course of a year. Also, like many numbers in modern science, the formal definition of the astronomical unit has been altered a bit. As of 2012, 1 AU = 149,597,870,700 meters exactly, regardless of whether we find the Earth's semi-major axis is slightly different in the future.

Tl;dr: Bunch of guys, over a period of two thousand years, armed with a bit of creative ingenuity and a celestial phenomenon, used high school level trigonometry to figure it out.