Measurement-device-independent quantum key distribution (MDIQKD) with the decoy-state method negates security threats of both the imperfect single-photon source and detection losses. Lengthening the distance and improving the key rate of quantum key distribution (QKD) are vital issues in practical applications of QKD. Herein, we report the results of MDIQKD over 404 km of ultralow-loss optical fiber and 311 km of a standard optical fiber while employing an optimized four-intensity decoy-state method. This record-breaking implementation of the MDIQKD method not only provides a new distance record for both MDIQKD and all types of QKD systems but also, more significantly, achieves a distance that the traditional Bennett-Brassard 1984 QKD would not be able to achieve with the same detection devices even with ideal single-photon sources. This work represents a significant step toward proving and developing feasible long-distance QKD.