This work focuses on recurrence and ergodicity of switching diffusions consisting of continuous and discrete components, in which the discrete component takes values in a countably infinite set and the rates of switching at current time depend on the value of the continuous component over an interval including certain past history. Sufficient conditions for recurrence and ergodicity are given. Moreover, the relationship between systems of partial differential equations and recurrence when the switching is pastindependent is established under suitable conditions. Emerging and existing applications in wireless communications, queueing networks, biological models, ecological systems, financial engineering, and social networks demand the mathematical modeling, analysis, and computation of hybrid systems in which continuous dynamics and discrete events coexist. Switching diffusions are one of such hybrid models. A switching diffusion is a two-component process (X(t), α(t)), a continuous component and a discrete component taking values in a set consisting of isolated points. When the discrete component takes a value α (i.e., α(t) = α), the continuous component X(t) evolves according to the diffusion process whose drift and diffusion coefficients depend on α. Such processes have received growing attention recently because of their ability to a wide range of applications; see [11,13,20,26] and the references therein.In the comprehensive treatment of hybrid switching diffusions in [14], it was assumed that α(t) is a continuous-time and homogeneous Markov chain independent of the Brownian motion and that the generator of the Markov chain is a constant matrix. For broader impact on applications, considering the two components jointly, the work [25] extended the study to the Markov process (X(t), α(t)) by allowing the generator of α(t) to depend on the current state X(t). Until very recently, most of the works treat α(t) as a process taking values in a finite set. Even when α(t) is allowed to take values in a countable state space, almost all works required the systems being memoryless. That is, the switching depends on the continuous state, with the dependence on the current continuous state only, no delays are involved; see, for example, [14,19,20,25] and references therein. To be able to treat more complex models and to broaden the applicability, we have undertaken the task of investigating the dynamics of (X(t), α(t)) in which α(t) has a countable state space and its switching intensities depend on the history of the continuous component X(t). As a first attempt, this type of switching diffusion was considered in [16], which was motivated by queueing and control systems applications. In particular, the evolution of two interacting species was considered in the aforementioned reference. One of the species is micro described by a logistic differential equation perturbed by a white noise, and the other is macro. Let X(t) be the density of the micro species and α(t) the population of the macro species. The reproduction proce...