Localized frictional sliding on faults in the continental crust transitions at depth to distributed deformation in viscous shear zones. This brittle-ductile transition (BDT), and/or the transition from velocity-weakening (VW) to velocity-strengthening (VS) friction, are controlled by the lithospheric thermal structure and composition. Here we investigate these transitions, and their effect on the depth extent of earthquakes, using 2D antiplane shear simulations of a strike-slip fault with rate-and-state friction. The off-fault material is viscoelastic, with temperature-dependent dislocation creep. We solve the heat equation for temperature, accounting for frictional and viscous shear heating that creates a thermal anomaly relative to the ambient geotherm which reduces viscosity and facilitates viscous flow. We explore several geotherms and effective normal stress distributions (by changing pore pressure), quantifying the thermal anomaly, seismic and aseismic slip, and the transition from frictional sliding to viscous flow. The thermal anomaly can reach several hundred degrees below the seismogenic zone in models with hydrostatic pressure, but is smaller for higher pressure (and these high-pressure models are most consistent with San Andreas Fault heat flow constraints). Shear heating raises the BDT, sometimes to where it limits rupture depth rather than the frictional VW-to-VS transition. Our thermomechanical modeling framework can be used to evaluate lithospheric rheology and thermal models through predictions of earthquake ruptures, postseismic and interseismic crustal deformation, heat flow, and the geological structures that reflect the complex deformation beneath faults.