I've heard that we can play X-wing with 4 players. Does anyone know if this requires an expansion, or is it perhaps a house rule?
The game is structured such that there are shared turn phases. Everyone's moves happen in a single phase and the order is determined by model statistics. Then everyone's shooting happens in a single phase and the order is determined by model statistics. You can basically add as many people to that system as you like and they just take their actions in order based on their model's stats.
To play in two teams of two all you need is to own enough models so that each team member has enough to control that the game is interesting.
To play in a free-for-all with more than two players the only house rule required would be determining the tie-breaker for who goes first when two models have tied statistics. (In the two player game it is always Imperials have the initiative if all other checks are tied, so if there are "imperial" players who are enemies you need a system to break the tie.)
This is in the core rules; you need enough expansions that there is at least one ship per player:
Team Play Rules
Although a game of X-Wing always consists of two sides, the Rebellion and the Empire, it is possible to play the game with more than two players. To play with more than two players, the players divide themselves as equally as possible into teams. One team plays the Rebellion while the other team plays the Empire.
It is recommended that players use the squad building rules when playing with teams (see page 18). Each team receives the same number of squad points regardless of the number of players on that team.
Each player takes ownership over a number of ships on his team, as agreed on by the other players on his team. Each player plans maneuvers for his own ships and makes all decisions for his actions and attacks. Abilities that affect ships belonging to the same team (for example “Biggs Darklighter’s” ability) affect all ships on that team, regardless of who the owner is.
Players win (and lose) together as a team. It is possible for all of one player’s ships to be destroyed, but for his team to win if his teammate manages to destroy all of the opposing team’s ships.
Alternatively, you can have the team just manage the ships on their side together, though this is technically a house rule.
I'd caution against trying a free for all (which is not officially supported in the rules but is easy to house rule). In a free for all, due to the deadliness of combat, the player who wins is the one who is able to avoid other ships the longest rather than the one who is able to attack the best. This creates a perverse incentive to avoid confrontation, making the game a lot less fun.