Using a capacitive touch sensor as a switch for an led strip

I am using a capacitive touch sensor as a switch to turn on and off an led strip. So far with my code, it only stays on when the touch sensor is pressed. I want it to turn on when pressed and stay on until pressed again. Please help!

#include <CapacitiveSensor.h>

CapacitiveSensor   cs_4_8 = CapacitiveSensor(4,8); // 1M resistor between pins 4 & 8, pin 8 is sensor pin, add a wire and or foil

void setup()                    
{
   cs_4_8.set_CS_AutocaL_Millis(0xFFFFFFFF);// turn off autocalibrate on channel 1 - just as an example
   Serial.begin(9600);
   pinMode(5,OUTPUT);
}

void loop() {
 int i;
 
 long sensor1 =  cs_4_8.capacitiveSensor(50);

    Serial.println(sensor1);  // print sensor output 
   if(sensor1 >= 400)
   {
    analogWrite(5,50);
   }
   else{
    analogWrite(5,0);
   }  

}

How about something like this:

if (sensorTouched)
    {
        LEDStripOn != LEDStripOn;
    }

if (LEDStripON)
    {
        analogWrite(5,50);
     }
else
    {
        analogWrite(5,0);
    }

Look at the state change detection example. While it specifically refers to digital pins, you have a state change happening, when the value BECOMES more, not IS more, than 400. THAT is when to change the output.