The measurement-device-independent quantum key distribution (MDI-QKD) protocol plays an important role in quantum communications due to its high level of security and practicability. It can be immune to all side-channel attacks directed on the detecting devices. However, the protocol still contains strict requirements during state preparation in most existing MDI-QKD schemes, e.g., perfect state preparation or perfectly characterized sources, which are very hard to realize in practice. In this letter, we investigate uncharacterized MDI-QKD by utilizing a three-state method, greatly reducing the finite-size effect. The only requirement for state preparation is that the state are prepared in a bidimensional Hilbert space. Furthermore, a proof-of-principle demonstration over a 170 km transmission distance is achieved, representing the longest transmission distance under the same security level on record.