The median of a graph G with weighted vertices is the set of all vertices x minimizing the sum of weighted distances from x to the vertices of G. For any integer p ≥ 2, we characterize the graphs in which, with respect to any non-negative weights, median sets always induce connected subgraphs in the pth power G p of G. This extends some characterizations of graphs with connected medians (case p = 1) provided by Bandelt and Chepoi (2002). The characteristic conditions can be tested in polynomial time for any p. We also show that several important classes of graphs in metric graph theory, including bridged graphs (and thus chordal graphs), graphs with convex balls, bucolic graphs, and bipartite absolute retracts, have G 2 -connected medians. Extending the result of Bandelt and Chepoi that basis graphs of matroids are graphs with connected medians, we characterize the isometric subgraphs of Johnson graphs and of halved-cubes with connected medians.