We present a bright galaxy sample with accurate and precise photometric redshifts (photo-zs), selected using ugriZYJHKs photometry from the Kilo-Degree Survey (KiDS) Data Release 4 (DR4). The highly pure and complete dataset is flux-limited at r<20 mag, covers ∼1000 deg2, and contains about 1 million galaxies after artifact masking. We exploit the overlap with Galaxy And Mass Assembly (GAMA) spectroscopy as calibration to determine photo-zs with the supervised machine learning neural network algorithm implemented in the ANNz2 software. The photo-zs have mean error of |⟨δz⟩|∼5×10−4 and low scatter (scaled mean absolute deviation of ∼0.018(1+z)), both practically independent of the r-band magnitude and photo-z at 0.05<zphot<0.5. Combined with the 9-band photometry, these allow us to estimate robust absolute magnitudes and stellar masses for the full sample. As a demonstration of the usefulness of these data we split the dataset into red and blue galaxies, use them as lenses and measure the weak gravitational lensing signal around them for five stellar mass bins. We fit a halo model to these high-precision measurements to constrain the stellar-mass--halo-mass relations for blue and red galaxies. We find that for high stellar mass (M⋆>5×1011M⊙), the red galaxies occupy dark matter halos that are much more massive than those occupied by blue galaxies with the same stellar mass.