Suppose that $P:\mathbb{R}^n\to\mathbb{R}$ is a degree $D$ polynomial with real coefficients. Let $Z(P) = \{x\in\mathbb{R}^n \mid P(x)=0\}$ be the zero set of $P$, and let $N(P)$ be the number of connected components of $\mathbb{R}^d\setminus Z(P)$. I recall learning once a bound of the form $$ N(P) \leq C_n D^n, $$ but I can't track down the reference.
I am particularly interested in the case $n\geq 3$ because I believe I have proofs of this bound for $n=1$ and $n=2$. Indeed, the bound when $n=1$ just follows from the fact that $Z(P)$ can contain at most $D$ points.
In $n=2$ I think I also have a proof based on the polynomial ham sandwich theorem -- let $P$ be a polynomial which splits $\mathbb{R}^n$ into $N$ connected components. By the polynomial ham sandwich theorem we can find a polynomial of degree $C\sqrt{N}$ whose zero set enters each connected component. In particular the number of connected components $N$ is bounded by the number of intersections of the zero set $Z(P)\cap Z(Q)$, and using Bezout's theorem we therefore have $$ N \leq C\sqrt{N} D, $$ which rearranges to $N \leq CD^2$ as desired.
It is therefore the higher dimensional cases I would like help with. Any help in the form of a reference or a proof would be appreciated!