To further advance functional magnetic resonance imaging (fMRI)-based brain science, it is critical to dissect fMRI activities at a circuit level. To solve this issue, we propose to combine brain-wide fMRI with neuronal silencing in well-defined regions via temporally specific optogenetic stimulation. Since focal inactivation suppresses excitatory output to downstream pathways, intact input and downregulated output circuits can be separated. Highly specific cerebral blood volume-weighted fMRI was performed with optogenetic simulation of local GABAergic neurons in mouse somatosensory regions at 15.2 T. Brain-wide spontaneous somatosensory networks were found mostly in ipsilateral cortical and subcortical areas, which differ from the bilateral homotopic connections commonly observed in resting-state fMRI. Evoked fMRI response to somatosensory stimulation were dissected to spinothalamic, thalamocortical (TC), corticothalamic (CT), corticocortical (CC) inputs and local intracortical circuits. The primary somatosensory cortex (S1) receives TC inputs from the ventral posterior thalamic nucleus with spinothalamic inputs. The primary motor cortex (M1) has feedforward CC inputs from S1, and the posterior medial thalamic nucleus also receives CT inputs from S1. The secondary somatosensory cortex (S2) receives mostly direct CC inputs from S1 and a small amount of TC inputs. The TC and CC input layers in cortical regions were identified by laminar-specific fMRI responses. The long-range synaptic input in cortical areas is amplified approximately 2-fold by local intracortical circuits, which is consistent with electrophysiological recordings. Overall, whole-brain fMRI with optogenetic inactivation provides brain-wide, population-based long-range circuits, which will complement conventional microscopic functional circuit studies.