As potential candidates for deep-UV nonlinear optical (NLO) crystals, borosilicates and borogermanates, which contain NLO-active groups such as B-O, Si-O, and Ge-O groups, have fascinated many material scientists' research enthusiasm. In this paper, the electronic structures and optical properties of two isostructural noncentrosymmetric crystals LaBRO5 (R = Si and Ge) have been studied by the first-principles method. Combined with the analyses of the SHG-density and the localized electron-density difference, contributions of the constituent tetrahedra to the total NLO responses are investigated. Eventually, BO4 and GeO4 groups give nearly equal contributions to the SHG effect of LaBGeO5, but for LaBSiO5, SiO4 groups express stronger SHG response than that of BO4. Such interesting conclusion is consistent with the distortion index analyses and dipole moment.