We measure the gap density of states and the Fermi level position in thin-film transistors based on pentacene and dinaphtho[2,3-b:2^{'},3^{'}-f]thieno[3,2-b]thiophene (DNTT) films grown on various surfaces using Kelvin probe force microscopy. It is found that the density of states in the gap of pentacene is extremely sensitive to the underlying interface and governs the Fermi level energy in the gap. The density of gap states in pentacene films grown on bare silicon dioxide (SiO_{2}) was found to be larger by 1 order of magnitude compared to that in pentacene grown on SiO_{2} treated with hexamethyldisilazane and larger by 2 orders of magnitude compared to that of pentacene grown on aluminum oxide (AlO_{x}) treated with a self-assembled monolayer (SAM) of n-tetradecylphosphonic acid (HC_{14}-PA). When DNTT was grown on HC_{14}-PA-SAM-treated AlO_{x}, the gap density of states was even smaller, so that the Fermi level pinning was significantly reduced. The correlation between the measured gap density of states and the transistor performance is demonstrated and discussed.