Using a stochastic discount factor approach, this paper derives the exact solution for bond yields in the case that the short-term interest rate follows a threshold process with the intercept switching endogenously. The yield functions, mapping the one-month rate into n-period yields, exhibit a convex/concave shape to the left and the right of the threshold value, respectively. This particular pattern in the yield function is confirmed by US bond yield data. The intervals for which convexity or concavity prevails increase with time to maturity. The problem with the derived exact yield function is that it can actually be computed for yields with a small time to maturity only (say until six months). Approximations of our exact solution or simulation-based techniques have to be applied for longer times to maturity so far.Substantial implications arise for the risk management of bond portfolios. Risk measures reveal a nonlinear pattern at the threshold value that decays if moving away from it. Linear Gaussian and CIR type of models can not account for this type of functional form since they imply an affine yield function. Therefore, ignoring this fact leads to an under- or overestimation of risk near the threshold depending on the chosen risk measures. This new type of term structure model belongs to the regime-switching class but in contrast to the popular Markov-switching case it is determined completely by observable variables within a no-arbitrage framework. The derived solution can be applied to a wide range of threshold dynamics for the underlying state variables.