The Kilo-Degree Survey (KiDS) is an ongoing optical wide-field imaging survey with the OmegaCAM camera at the VLT Survey Telescope, specifically designed for measuring weak gravitational lensing by galaxies and large-scale structure. When completed it will consist of 1350 square degrees imaged in four filters (ugri). Here we present the fourth public data release which more than doubles the area of sky covered by data release 3. We also include aperture-matched ZYJHKs photometry from our partner VIKING survey on the VISTA telescope in the photometry catalogue. We illustrate the data quality and describe the catalogue content. Two dedicated pipelines are used for the production of the optical data. The Astro-WISE information system is used for the production of co-added images in the four survey bands, while a separate reduction of the r-band images using the theli pipeline is used to provide a source catalogue suitable for the core weak lensing science case. All data have been re-reduced for this data release using the latest versions of the pipelines. The VIKING photometry is obtained as forced photometry on the theli sources, using a re-reduction of the VIKING data that starts from the VISTA pawprints. Modifications to the pipelines with respect to earlier releases are described in detail. The photometry is calibrated to the Gaia DR2 G band using stellar locus regression. In this data release a total of 1006 square-degree survey tiles with stacked ugri images are made available, accompanied by weight maps, masks, and single-band source lists. We also provide a multi-band catalogue based on r-band detections, including homogenized photometry and photometric redshifts, for the whole dataset. Mean limiting magnitudes (5 sigma in a 2" aperture) are 24.23, 25.12, 25.02, 23.68 in ugri, respectively, and the mean r-band seeing is 0.70".