For this kind of operation I use what is known as a "state machine". - You can read up on them on Wikipedia here
Basically, your program is in one of a set number of "states". The buttons, when you press them, change the state. The state is used to determine what the program is actively doing at any moment in time. Any other action can be used to change the state as well as a button, for instance a counter getting to a specific number.
Take this as an (untested) example:
#define STATE_LED_OFF 0
#define STATE_LED_SWITCH_ON 1
#define STATE_LED_ON 2
#define STATE_LED_SWITCH_OFF 3
void loop()
{
static unsigned char state = STATE_LED_OFF;
static unsigned long timer = 0;
switch(state)
{
case STATE_LED_SWITCH_ON:
digitalWrite(13,HIGH);
state = STATE_LED_ON;
timer = millis();
break;
case STATE_LED_SWITCH_OFF:
digitalWrite(13,LOW);
state = STATE_LED_OFF;
break;
case STATE_LED_ON:
if(millis() - timer > 5000)
state = STATE_LED_SWITCH_OFF;
break;
}
if(digitalRead(2)==HIGH)
{
state = STATE_LED_SWITCH_ON;
}
if(digitalRead(3)==HIGH)
{
state = STATE_LED_SWITCH_OFF;
}
}
Basically, that will turn on the LED if input 2 goes high, and switch it off if input 3 is high. If 5000 milliseconds have passed while the LED is on (5 seconds) then switch it off. Note the use of "static" variables, which retain their value over successive calls to the loop() function. You could use global variables instead, but I prefer to keep variables in-scope as much as possible - it's good programming practice.