  For each nonzero $h\in \mathbb{F}[x]$, where $\mathbb{F}$ is a field, let
$\mathsf{A}_h$ be the unital associative algebra generated by elements $x,y$,
satisfying the relation $yx-xy = h$. This gives a parametric family of
subalgebras of the Weyl algebra $\mathsf{A}_1$, containing many well-known
algebras which have previously been studied independently. In this paper, we
give a full description the Hochschild cohomology
$\mathsf{HH}^\bullet(\mathsf{A}_h)$ over a field of arbitrary characteristic.
In case $\mathbb{F}$ has positive characteristic, the center of $\mathsf{A}_h$
is nontrivial and we describe $\mathsf{HH}^\bullet(\mathsf{A}_h)$ as a module
over its center. The most interesting results occur when $\mathbb{F}$ has
characteristic $0$. In this case, we describe
$\mathsf{HH}^\bullet(\mathsf{A}_h)$ as a module over the Lie algebra
$\mathsf{HH}^1(\mathsf{A}_h)$ and find that this action is closely related to
the intermediate series modules over the Virasoro algebra. We also determine
when $\mathsf{HH}^\bullet(\mathsf{A}_h)$ is a semisimple
$\mathsf{HH}^1(\mathsf{A})$-module.
