Stop Arduino Timer after some seconds
You set a timestamp = millis() when the button is pushed and then you disable the buzzer only when millis() - timestamp &gt; timeout 

if (touchsensorState == HIGH) {
    // buzzer will emit sound:
    digitalWrite(buzzer, HIGH);
    timestamp = millis();
} 
if(millis() - timestamp &gt; timeout) {
    // buzzer will not sound:
    digitalWrite(buzzer, LOW);
}