Here's the short, idealized answer:

By the Sui/Tang Dynasty transition we have "rhyme books" (essentially phonological dictionaries) that detail every tone and phoneme for every character through successive dynasties, both through a variety of diagrams and categorizations, but also through a method called Fanqie (where every character's pronunciation is represented by two characters which separately represent the original character's initial sound and final sound).

While this yields all the phonemes of the language, we don't have their phonetic realizations from that alone (i.e. we know how many distinct sounds we have and their relationships to each other, but we don't know the precise, actual sounds quite yet). To find those, we use the usual other tools at the disposal of historical linguists which include:

+ Finding foreign loan words or transliterations and using the foreign language's pronunciation. A particularly fruitful source from this time period is Buddhist translations, which incorporate many words from Sanskrit.
+ Comparative reconstruction based on current Chinese varieties.
+ Analyzing what speakers themselves say about the phonetic realizations of the language.

By tracing this back to our first extant rhyme dictionary, called the Qieyun, with the attendant phonological system sometimes abbreviated as QYS for the Qieyun System, we arrive at what we call Middle Chinese (which is a concept that is fraught with danger as I detail later).

Although we still have some rather noticeable holes in our knowledge of the phonetic realizations of this system (the biggest is that we aren't certain of the exact phonetic realizations of three of the four tones of the QYS), we have on the whole a pretty solid understanding of the sounds of the language up to this period.

Going even earlier (i.e. Old Chinese) quickly becomes much more fraught with uncertainty without the aid of rhyme dictionaries. We are forced to rely much more on rhyming we observe in poetry as well as theoretical internal reconstruction based on our much more stable reconstruction of the QYS. By looking extensively at ancient poetry collections such as the Shijing and Chuci we can back out some system of phonological categories. As such these earlier reconstructions are far more contentious and uncertain.

The messier answer:

Middle Chinese (or Middle Sinitic as Mair calls it) was taken seriously as a language that people actually spoke and as the ancestor of Chinese varieties by the early Sinologist Bernhard Karlgren. This has led to terms such as "Early Middle Chinese" and "Late Middle Chinese" and trying to date those etc. This has changed significantly in the last 40-50 years. Modern Sinologists who study the evolution of the language basically refute every clause of what I just said. In particular,

+ Middle Chinese does not represent a language anyone actually spoke. It's an abstract system of phonological categories that represents a compromise among different varieties spoken at the time, resulting in more phonemes than any real human actually used in normal life.
+ As such terms such as "Early Middle Chinese" or "Late Middle Chinese" are linguistically incoherent, since there was never an organic language to evolve in the first place.
+ The traditional genetic, tree model of language families (with e.g. different descendant languages evolving from a single ancestor) is not a useful model for the evolution of Chinese, especially in the last two millennia. As such the whole enterprise of trying to find a most recent common ancestor for varieties of Chinese (or even subsets such as all varieties minus Min or all varieties minus Min and Wu) is methodologically suspect.
+ To the extent that you still try to find the most recent common ancestor for even non-Min/non-Wu languages, you are likely to arrive at a time period that far predates the QYS, and hence the word "Middle" no longer seems like an accurate chronological descriptor.

A new crop of terms has shown up to try to displace Middle Chinese and focus on trying to reconstruct a real language people actually spoke (e.g. "Medieval Chinese"), but even that is still quite messy.

The story of Old Chinese is even more contentious and is completely fractured in the academic community. Some Sinologists have staked their entire careers on a coherent notion of "Old Chinese" and its reconstruction. Other Sinologists dismiss the entire enterprise as unworkable, apart from potentially much more isolated and restricted subsystems. It's all very controversial.