P-type boron-doped amorphous silicon and carbon alloy (B-doped a-SixC1-x) thin films with wide optical gap selective from 1.80 to 2.50 eV were successfully deposited by radio frequency (r.f.) plasma-enhanced chemical vapor deposition (CVD) method using a mixed solution of tetramethylsilane (TMS) and trimethylborate (TMOB) as a liquid source. Optical gaps of the B-doped a-SixC1-x films could be controlled by changing Si/(C + Si) ratio of the film. From photo-electrochemical measurement under UV illumination, it was clarified that the B-doped a-SixC1-x film with an optical gap of 2.50 eV has the p-type semiconducting property and photoelectric conversion function with a quantum yield of 1.63 %. The rectifying action of a p-n heterojunction comprising p-type B-doped a-SixC1-x film and n-type Si (100) substrate was observed. The open circuit voltage (VOC) and short circuit current density (JSC) of the heterojunction were estimated to be 200 mV and 45 mA/cm2, respectively. The results indicate that p-type B-doped a-SixC1-x films with controllable optical gaps is a promising p-layer material for multi-junction solar cells.