The linear and quadratic nonlinear optical properties of donor-acceptor polyphenyls and naphthyl derivatives are investigated. The behaviour of the static first-order hyperpolarizability beta(0) as a function of the number n of phenyl units separating an acceptor group (cyano) and a donor group (methylthio) is studied for n = 1, 2, 3, and compared to that of similar polyphenyls bearing other donor substituents (N,N-dimethylamino, methoxy). Beta(0) is also measured for unsymmetrical donor-acceptor biaryls containing at least one naphthyl unit. A clear influence of the twist angle between the two aryl units on the quadratic nonlinear response of the molecule is evidenced, allowing for fine control of the transparency/nonlinear efficiency trade-off.