  We study the two-parameter quadratic sieve for a general test function. We
prove, under some very general assumptions, that the function considered by
Barban and Vehov [BV68] and Graham [Gra78] for this problem is optimal up to
and including the second-order term. We determine that second-order term
explicitly.
