Selecting a suitable site to deposit their eggs is an important reproductive need of Drosophila females. Although their choosiness toward egg-laying sites is well documented, the specific neural mechanism that activates females' search for attractive egg-laying sites is not known. Here, we show that distention and contraction of females' internal reproductive tract triggered by egg delivery through the tract plays a critical role in activating such search. We found that females start to exhibit acetic acid (AA) attraction prior to depositing each egg but no attraction when they are not laying eggs. Artificially distending the reproductive tract triggers AA attraction in non-egg-laying females, whereas silencing the mechanosensitive neurons we identified that can sense the contractile status of the tract eliminates such attraction. Our work uncovers the circuit basis of an important reproductive need of Drosophila females and provides a simple model for dissecting the neural mechanism that underlies a reproductive need-induced behavioral modification.