Context.The impact of stellar mass on the properties of giant planets is still not fully understood. Main-sequence (MS) stars more massive than the Sun remain relatively unexplored in radial velocity (RV) surveys, due to their characteristics which hinder classical RV measurements.Aims.Our aim is to characterize the close (up to ~2 au) giant planet (GP) and brown dwarf (BD) population around AF MS stars and compare this population to stars with different masses.Methods.We used the SOPHIEspectrograph located on the 1.93 m telescope at Observatoire de Haute-Provence to observe 125 northern, MS AF dwarfs. We used our dedicated SAFIRsoftware to compute the RV and other spectroscopic observables. We characterized the detected substellar companions and computed the GP and BD occurrence rates combining the present SOPHIEsurvey and a similar HARPSsurvey.Results.We present new data on two known planetary systems around the F5-6V dwarfs HD 16232 and HD 113337. For the latter, we report an additional RV variation that might be induced by a second GP on a wider orbit. We also report the detection of 15 binaries or massive substellar companions with high-amplitude RV variations or long-term RV trends. Based on 225 targets observed with SOPHIEand/or HARPS, we constrain the BD frequency within 2–3 au around AF stars to be below 4% (1σ). For Jupiter-mass GPs within 2–3 au (periods ≤103days), we find the occurrence rate to be 3.7−1+3% around AF stars with masses <1.5M⊙, and to be ≤6% (1σ) around AF stars with masses >1.5M⊙. For periods shorter than 10 days, we find the GP occurrence rate to be below 3 and 4.5% (1σ), respectively. Our results are compatible with the GP frequency reported around FGK dwarfs and are compatible with a possible increase in GP orbital periods with stellar mass as predicted by formation models.