Semiconductor photocatalysis driven by electron/hole has begun a new era in the field of solar energy conversion and storage. Here we report the fabrication and optimization of TiO2/BDD p-n heterojunction photoelectrode using p-type boron doped diamond (BDD) and n-type TiO2 which shows enhanced photoelectrochemical activity. A p-type BDD was first deposited on Si substrate by microwave plasma chemical vapor deposition (MPCVD) method and then n-type TiO2 was sputter coated on top of BDD grains for different durations. The microstructural studies reveal a uniform disposition of anatase TiO2 and its thickness can be tuned by varying the sputtering time. The formation of p-n heterojunction was confirmed through I-V measurement. A remarkable rectification property of 63773 at 5 V with very small leakage current indicates achieving a superior, uniform and precise p-n junction at TiO2 sputtering time of 90 min. This suitably formed p-n heterojunction electrode is found to show 1.6 fold higher photoelectrochemical activity than bare n-type TiO2 electrode at an applied potential of +1.5 V vs SHE. The enhanced photoelectrochemical performance of this TiO2/BDD electrode is ascribed to the injection of hole from p-type BDD to n-type TiO2, which increases carrier separation and thereby enhances the photoelectrochemical performance.