We show that the group QxQ+* of orientation-preserving affine transformations of the rational numbers is quasi-lattice ordered by its subsemigroup NxNx—. The associated Toeplitz C*-algebra T(NxNx) is universal for isometric representations which are covariant in the sense of Nica. We give a presentation of T(NxNx) in terms of generators and relations, and use this to show that the C*-algebra QN recently introduced by Cuntz is the boundary quotient of (QxQ+*, NxNx) in the sense of Crisp and Laca. The Toeplitz algebra T(NxNx) carries a natural dynamics σ, which induces the one considered by Cuntz on the quotient QN, and our main result is the computation of the KMSβ (equilibrium) states of the dynamical system (T(NxNx),R,σ) for all values of the inverse temperature β. For β ∈[1,2] there is a unique KMSβ state, and the KMS1 state factors through the quotient map onto QN, giving the unique KMS state discovered by Cuntz. At β=2 there is a phase transition, and for β>2 the KMSβ states are indexed by probability measures on the circle. There is a further phase transition at β=∞, where the KMS∞ states are indexed by the probability measures on the circle, but the ground states are indexed by the states on the classical Toeplitz algebra T(N).