Doxepin is a tricyclic antidepressant that, at very low doses, is actually FDA-approved specifically for insomnia (marketed as Silenor at that low dose) — different from trazodone, whose insomnia use remains entirely off-label at any dose. At higher, antidepressant-range doses, doxepin carries more anticholinergic burden than trazodone.
Practically, this means low-dose doxepin has a more specific regulatory approval for sleep than trazodone does, while trazodone has a longer track record of off-label insomnia use and may be preferred when coexisting depression is also a treatment target.