Context: IRAS 04166+2706 in Taurus is one of the most nearby young stellar objects whose molecular outflow contains a highly collimated fast component. Methods: We have observed the IRAS 04166+2706 outflow with the IRAM Plateau de Bure interferometer in CO(J=2-1) and SiO(J=2-1) achieving angular resolutions between 2 and 4. To improve the quality of the CO(2-1) images, we have added single dish data to the interferometer visibilities. Results: The outflow consists of two distinct components. At velocities <10 km/s, the gas forms two opposed, approximately conical shells that have the YSO at their vertex. These shells coincide with the walls of evacuated cavities and seem to result from the acceleration of the ambient gas by a wide-angle wind. At velocities >30 km/s, the gas forms two opposed jets that travel along the center of the cavities and whose emission is dominated by a symmetric collection of at least 7 pairs of peaks. The velocity field of this component presents a sawtooth pattern with the gas in the tail of each peak moving faster than the gas in the head. This pattern, together with a systematic widening of the peaks with distance to the central source, is consistent with the emission arising from internal working surfaces traveling along the jet and resulting from variations in the velocity field of ejection. We interpret this component as the true protostellar wind, and we find its composition consistent with a chemical model of such type of wind. Conclusions: Our results support outflow wind models that have simultaneously wide-angle and narrow components, and suggest that the EHV peaks seen in a number of outflows consist of internally-shocked wind material.