The roles of critical valence fluctuations of Ce and Yb are discussed as a key origin of several anomalies observed in Ce- and Yb-based heavy fermion systems. Recent development of the theory has revealed that a magnetic field is an efficient control parameter to induce the critical end point of the first-order valence transition. Metamagnetism and non-Fermi liquid behavior caused by this mechanism are discussed by comparing favorably with CeIrIn5, YbAgCu4 and YbIr2Zn20. The interplay of the magnetic order and valence fluctuations offers a key concept for understanding Ce- and Yb-based systems. It is shown that suppression of the magnetic order by enhanced valence fluctuations gives rise to the coincidence of the magnetic-transition point and valence crossover point at absolute zero as a function of pressure or magnetic field. The interplay is shown to resolve the outstanding puzzle in CeRhIn5 in a unified way. The broader applicability of this newly clarified mechanism is discussed by surveying promising materials such as YbAuCu4, β-YbAlB4 and YbRh2Si2.