We study the mean first passage time (MFPT) to an absorbing target of a one-dimensional Brownian particle subject to an external potential v(x) in a finite domain. We focus on the cases in which the external potential is confining, of the form v(x) = k|x − x 0 | n /n, and where the particle's initial position coincides with x 0 . We first consider a particle between an absorbing target at x = 0 and a reflective wall at x = c. At fixed x 0 , target encounter is accelerated by increasing the potential stiffness k from zero, but only when the size of the domain c is above a critical value. In this case, the MFPT gets minimized at an optimal stiffness k opt > 0. Conversely, if the size of the system is below the critical size, pure diffusion (k opt = 0) becomes optimal. Hence, for any value of n, the optimal potential stiffness undergoes a continuous "freezing" transition as the domain size is varied. On the other hand, when the reflective wall is replaced by a second absorbing target, the freezing transition in k opt becomes discontinuous. The phase diagram in the (x 0 , n)-plane then exhibits three dynamical phases and metastability, with a "triple" point at (x 0 /c 0.17185, n 0.39539). For harmonic or higher order potentials (n ≥ 2), the MFPT always increases with k at small k, for any x 0 or domain size. These results are contrasted with problems of diffusion under optimal resetting in bounded domains.