The development of ultraviolet (UV) nonlinear optical (NLO) crystals demands optical materials with wide energy band gaps. Here we report first-principles studies on the electronic structures in several UV NLO borates with representative structures. Combined with model analysis, we find that the oxygen non-bonding 2p orbitals play an important role on the top of valence bands. The energy band gap can be adjusted by modifying the coordination environment around the oxygen atoms. Under ideal conditions the energy band gaps achieve 9 eV if the non-bonding orbitals are totally eliminated, despite the original values varying from 6.6 to 8.3 eV.