Sensory cortices are organized in multiple interconnected layers and contain several functionally distinct neural subnetworks. Elucidating the logic of interaction within and between cortical layers and subnetworks is essential for understanding the cellular basis of cortical function. In this seminar, I will focus on the role of specific layers in the modulation of sensory responses in the mouse somatosensory cortex. I will also present the development and application of new optical methods to monitor and bidirectionally manipulate the activity of neurons with high spatial resolution. I will discuss how these new technologies may greatly facilitate our understanding of the network mechanisms underlying the function of thalamocortical circuits.