As highly efficient non-precious metal-based catalysts for the hydrogen evolution reaction (HER), the molybdenum carbides have attracted much attention over the phase and structure modification for the improvement of HER performances. In this work, a novel strategy is proposed to modulate phases of molybdenum carbides by boron doping, so that the HER performances can be well controlled. After B-doping, the HER activity of the as-prepared B30 catalyst is significantly enhanced with a much smaller Tafel slope of 78 mV dec-1 than that of the blank one (134 mV dec-1), which originates from the increased amount of active sites, enhanced turnover frequency of each active site and reduced electron transfer resistance. Moreover, this work could broaden our view of phase regulation and provide more possible perspectives for the application in other fields. © 2019 IOP Publishing Ltd.