Borrowing a page from the documentation, the simplest way is to create a ComplexityFunction that makes Sin more expensive, as follows:
solns = DSolve[y''[x] + y[x] == a Cos[2 x] + b Cos[x] + c Cos[2 x - 3] + d Cos[2 x]^2 - 6 d Cos[2 x] + 9 d + e Cos[x]^2 + f Cos[x] Cos[3 x] + h Cos[x]^2 Cos[2 x - 3] + i Cos[x]^4, y[x], x]; cfcn[e_] := 100 Count[e, _Sin, {0, Infinity}] + LeafCount[e] simp = Simplify[ solns, ComplexityFunction -> cfcn ] (* {{y[x] -> 1/120 (1140 d + 60 e + 45 i + 30 h Cos[3] - 2 h Cos[3 - 4 x] - 20 (2 c + h) Cos[3 - 2 x] + 60 b Cos[x] + 120 C[1] Cos[x] - 40 a Cos[2 x] + 240 d Cos[2 x] - 20 e Cos[2 x] - 20 f Cos[2 x] - 20 i Cos[2 x] - 4 d Cos[4 x] - 4 f Cos[4 x] - i Cos[4 x] + 60 b x Sin[x] + 120 C[2] Sin[x])}} *)
Note: it can't get rid of all of the Sin terms, but it got rid of most. Also, further tidying up can be done by using Collect:
Collect[ simp, {Sin[_], Cos[_]}] (* {{y[x] -> 1/120 (1140 d + 60 e + 45 i) + 1/4 h Cos[3] - 1/60 h Cos[3 - 4 x] - 1/6 (2 c + h) Cos[3 - 2 x] + 1/120 (60 b + 120 C[1]) Cos[x] + 1/120 (-40 a + 240 d - 20 e - 20 f - 20 i) Cos[2 x] + 1/120 (-4 d - 4 f - i) Cos[4 x] + 1/120 (60 b x + 120 C[2]) Sin[x]}} *)
fCosandi cos. If you fix that andSimplify, I think you get what you want (else look atTrigReduce), I hope that helps $\endgroup$